Class HttpHeaderExpectation

Description

Test for a specific HTTP header within a header block.

Located in /web_tester.php (line 134)

SimpleExpectation
   |
   --HttpHeaderExpectation
Direct descendents
Class Description
 class NoHttpHeaderExpectation Test for a specific HTTP header within a header block that should not be found.
Method Summary
 HttpHeaderExpectation __construct (string $header, [mixed $value = false], [string $message = '%s'])
 string findHeader (mixed $compare)
 mixed getExpectation ()
 void normaliseHeader (string $header, string 1)
 boolean test (mixed $compare)
 boolean testHeaderLine (string $line)
 boolean testHeaderValue (string $value, mixed $expected)
 string testMessage (mixed $compare)
Variables

Inherited Variables

Inherited from SimpleExpectation

SimpleExpectation::$dumper
Methods
Constructor __construct (line 148)

Sets the field and value to compare against.

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

Redefinition of:
SimpleExpectation::__construct()
Creates a dumper for displaying values and sets the test message.

Redefined in descendants as:
findHeader (line 192)

Searches the incoming result. Will extract the matching line as text.

  • return: Matching header line.
  • access: protected
string findHeader (mixed $compare)
  • mixed $compare: Raw header block to search.
getExpectation (line 159)

Accessor for aggregated object.

  • return: Expectation set in constructor.
  • access: protected
mixed getExpectation ()
normaliseHeader (line 170)

Removes whitespace at ends and case variations.

  • access: protected
void normaliseHeader (string $header, string 1)
  • string $header: Name of header.
  • string 1: Trimmed and lowecased header name.
test (line 181)

Tests the expectation. True if it matches a string value or an array value in any order.

  • return: True if header present.
  • access: public
boolean test (mixed $compare)
  • mixed $compare: Raw header block to search.

Redefinition of:
SimpleExpectation::test()
Tests the expectation. True if correct.

Redefined in descendants as:
testHeaderLine (line 208)

Compares a single header line against the expectation.

  • return: True if matched.
  • access: protected
boolean testHeaderLine (string $line)
  • string $line: A single line to compare.
testHeaderValue (line 226)

Tests the value part of the header.

  • return: True if matched.
  • access: protected
boolean testHeaderValue (string $value, mixed $expected)
  • string $value: Value to test.
  • mixed $expected: Value to test against.
testMessage (line 243)

Returns a human readable test message.

  • return: Description of success or failure.
  • access: public
string testMessage (mixed $compare)
  • mixed $compare: Raw header block to search.

Redefinition of:
SimpleExpectation::testMessage()
Returns a human readable test message.

Redefined in descendants as:

Inherited Methods

Inherited From SimpleExpectation

 SimpleExpectation::__construct()
 SimpleExpectation::getDumper()
 SimpleExpectation::isExpectation()
 SimpleExpectation::overlayMessage()
 SimpleExpectation::test()
 SimpleExpectation::testMessage()

Documentation generated on Sun, 31 Oct 2010 16:33:04 -0500 by phpDocumentor 1.4.3