Exemple #1
0
 /**
  * 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->domainMatches('example.com'));
     $this->assertTrue($cookie->domainMatches('example.net'));
     $this->assertTrue($cookie->pathMatches('/'));
     $this->assertTrue($cookie->pathMatches('/test'));
     $this->assertTrue($cookie->pathMatches('/test/'));
     $this->assertTrue($cookie->uriMatches(new Requests_IRI('http://example.com/')));
     $this->assertTrue($cookie->uriMatches(new Requests_IRI('http://example.com/test')));
     $this->assertTrue($cookie->uriMatches(new Requests_IRI('http://example.com/test/')));
     $this->assertTrue($cookie->uriMatches(new Requests_IRI('http://example.net/')));
     $this->assertTrue($cookie->uriMatches(new Requests_IRI('http://example.net/test')));
     $this->assertTrue($cookie->uriMatches(new Requests_IRI('http://example.net/test/')));
 }