public function testToCookieHeaderFormatsACookieHeader() { $cookie = new Cookie(); $cookie->setName('SESSION'); $cookie->setValue('asdf'); $this->assertEquals($cookie->toCookieHeader(), 'Cookie: SESSION=asdf'); }
public function testClearExpiredCookiesRemovesExpiredCookies() { $cookie = new Cookie(); $cookie->setName('SESSION'); $cookie->setValue('asdf'); $cookie->setAttribute(Cookie::ATTR_EXPIRES, 'Fri, 01-Dec-1999 00:00:00 GMT'); $jar = new Jar(); $jar->addCookie($cookie); $jar->clearExpiredCookies(); $this->assertEquals(count($jar->getCookies()), 0); $cookie = new Cookie(); $cookie->setName('SESSION'); $cookie->setValue('asdf'); $cookie->setAttribute(Cookie::ATTR_MAX_AGE, '-60'); $jar = new Jar(); $jar->addCookie($cookie); $jar->clearExpiredCookies(); $this->assertEquals(count($jar->getCookies()), 0); }