/** * Sets the field and value to compare against. * @param string $unwanted Case insenstive trimmed header name. * @param string $message Optiona message override. Can use %s as * a placeholder for the original message. */ function __construct($unwanted, $message = '%s') { parent::__construct($unwanted, false, $message); }
function testMultilineSearchWithPadding() { $expectation = new HttpHeaderExpectation('a', ' A '); $this->assertIdentical($expectation->test("aa:A\r\nb:B\r\nc:C"), false); $this->assertIdentical($expectation->test("aa:A\r\na:A\r\nb:B"), true); }
function testLocationHeaderSplitsCorrectly() { $expectation = new HttpHeaderExpectation('Location', 'http://here/'); $this->assertIdentical($expectation->test('Location: http://here/'), true); }
function testCaseInsensitivePatternMatching() { $expectation = new HttpHeaderExpectation('a', new PatternExpectation('/A/i')); $this->assertIdentical($expectation->test('a: a'), true); $this->assertIdentical($expectation->test('a: B'), false); $this->assertIdentical($expectation->test(' a : A '), true); $this->assertIdentical($expectation->test(' a : BAB '), true); $this->assertIdentical($expectation->test(' a : bab '), true); }