コード例 #1
0
ファイル: Cookies.php プロジェクト: VShangxiao/Requests
 /**
  * Manually set cookies without a domain/path set should always be valid
  *
  * Cookies parsed from headers internally in Requests will always have a
  * domain/path set, but those created manually will not. Manual cookies
  * should be regarded as "global" cookies (that is, set for `.`)
  */
 public function testUrlMatchManuallySet()
 {
     $cookie = new Requests_Cookie('requests-testcookie', 'testvalue');
     $this->assertTrue($cookie->domain_matches('example.com'));
     $this->assertTrue($cookie->domain_matches('example.net'));
     $this->assertTrue($cookie->path_matches('/'));
     $this->assertTrue($cookie->path_matches('/test'));
     $this->assertTrue($cookie->path_matches('/test/'));
     $this->assertTrue($cookie->uri_matches(new Requests_IRI('http://example.com/')));
     $this->assertTrue($cookie->uri_matches(new Requests_IRI('http://example.com/test')));
     $this->assertTrue($cookie->uri_matches(new Requests_IRI('http://example.com/test/')));
     $this->assertTrue($cookie->uri_matches(new Requests_IRI('http://example.net/')));
     $this->assertTrue($cookie->uri_matches(new Requests_IRI('http://example.net/test')));
     $this->assertTrue($cookie->uri_matches(new Requests_IRI('http://example.net/test/')));
 }