PHP Class HttpHeaderExpectation, simpletest

Inheritance: extends SimpleExpectation
Datei anzeigen Open project: simpletest/simpletest Class Usage Examples

Public Methods

Method Description
__construct ( string $header, mixed $value = false, string $message = '%s' ) Sets the field and value to compare against.
test ( mixed $compare ) : boolean Tests the expectation.
testMessage ( mixed $compare ) : string Returns a human readable test message.

Protected Methods

Method Description
findHeader ( mixed $compare ) : string Searches the incoming result. Will extract the matching line as text.
getExpectation ( ) : mixed Accessor for aggregated object.
normaliseHeader ( string $header ) Removes whitespace at ends and case variations.
testHeaderLine ( string $line ) : boolean Compares a single header line against the expectation.
testHeaderValue ( string $value, mixed $expected ) : boolean Tests the value part of the header.

Method Details

__construct() public method

Sets the field and value to compare against.
public __construct ( string $header, mixed $value = false, string $message = '%s' )
$header string Case insenstive trimmed header name.
$value mixed Optional value to compare. If not given then any value will match. If an expectation object then that will be used instead.
$message string Optiona message override. Can use %s as a placeholder for the original message.

findHeader() protected method

Searches the incoming result. Will extract the matching line as text.
protected findHeader ( mixed $compare ) : string
$compare mixed Raw header block to search.
return string Matching header line.

getExpectation() protected method

Accessor for aggregated object.
protected getExpectation ( ) : mixed
return mixed Expectation set in constructor.

normaliseHeader() protected method

Removes whitespace at ends and case variations.
protected normaliseHeader ( string $header )
$header string Name of header.

test() public method

True if it matches a string value or an array value in any order.
public test ( mixed $compare ) : boolean
$compare mixed Raw header block to search.
return boolean True if header present.

testHeaderLine() protected method

Compares a single header line against the expectation.
protected testHeaderLine ( string $line ) : boolean
$line string A single line to compare.
return boolean True if matched.

testHeaderValue() protected method

Tests the value part of the header.
protected testHeaderValue ( string $value, mixed $expected ) : boolean
$value string Value to test.
$expected mixed Value to test against.
return boolean True if matched.

testMessage() public method

Returns a human readable test message.
public testMessage ( mixed $compare ) : string
$compare mixed Raw header block to search.
return string Description of success or failure.