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('.127.0.0.1'); $this->assertFalse($cookie->matchesDomain('127.0.0.1')); $cookie->setDomain('127.0.0.1'); $this->assertTrue($cookie->matchesDomain('127.0.0.1')); $cookie->setDomain('.com.'); $this->assertFalse($cookie->matchesDomain('baz.com')); $cookie->setDomain('.local'); $this->assertTrue($cookie->matchesDomain('example.local')); }