コード例 #1
0
 public function testMatchesDomain()
 {
     $cookie = new Cookie();
     $this->assertTrue($cookie->matchesDomain('baz.com'));
     $cookie->setDomain('baz.com');
     $this->assertTrue($cookie->matchesDomain('baz.com'));
     $this->assertFalse($cookie->matchesDomain('bar.com'));
     $cookie->setDomain('.baz.com');
     $this->assertTrue($cookie->matchesDomain('.baz.com'));
     $this->assertTrue($cookie->matchesDomain('foo.baz.com'));
     $this->assertFalse($cookie->matchesDomain('baz.bar.com'));
     $this->assertTrue($cookie->matchesDomain('baz.com'));
     $cookie->setDomain('.com');
     $this->assertFalse($cookie->matchesDomain('baz.com'));
     $cookie->setDomain('.com.');
     $this->assertFalse($cookie->matchesDomain('baz.com'));
     $cookie->setDomain('.local');
     $this->assertTrue($cookie->matchesDomain('example.local'));
 }
コード例 #2
0
ファイル: CookiePluginTest.php プロジェクト: jorjoh/Varden
 public function testEscapesCookieDomains()
 {
     $cookie = new Cookie(array('domain' => '/foo/^$[A-Z]+/'));
     $this->assertFalse($cookie->matchesDomain('foo'));
 }