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.
示例#1
0
 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);
 }
示例#3
0
 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);
 }