/** * @param \Brick\Http\Cookie $cookie * @param \Brick\Http\Client\CookieOrigin $origin */ public function __construct(Cookie $cookie, CookieOrigin $origin) { $this->cookie = $cookie; $this->hostOnly = $cookie->getDomain() === null; $this->domain = $cookie->getDomain() === null ? $origin->getHost() : $cookie->getDomain(); $this->path = $cookie->getPath() === null ? $origin->getPath() : $cookie->getPath(); $this->path = self::getPathDirectory($this->path); $this->creationTime = time(); }
public function testConstructorAndDefaults() { $cookie = new Cookie('foo', 'bar'); $this->assertSame('foo', $cookie->getName()); $this->assertSame('bar', $cookie->getValue()); $this->assertSame(0, $cookie->getExpires()); $this->assertSame(null, $cookie->getPath()); $this->assertSame(null, $cookie->getDomain()); $this->assertFalse($cookie->isSecure()); $this->assertFalse($cookie->isHttpOnly()); }