function testCookieClearByLoweringDate() { $jar = new SimpleCookieJar(); $jar->setCookie('a', 'abc', false, '/', 'Wed, 25-Dec-02 04:24:21 GMT'); $jar->setCookie('a', 'def', false, '/', 'Wed, 25-Dec-02 04:24:19 GMT'); $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array('a=def')); $jar->restartSession('Wed, 25-Dec-02 04:24:20 GMT'); $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array()); }
function testCookieClearByDate() { $jar = new SimpleCookieJar(); $jar->setCookie(new SimpleCookie("a", "abc", "/", "Wed, 25-Dec-02 04:24:21 GMT")); $jar->setCookie(new SimpleCookie("a", "def", "/", "Wed, 25-Dec-02 04:24:19 GMT")); $cookies = $jar->getValidCookies(false, "/"); $this->assertIdentical($cookies[0]->getValue(), "def"); $jar->restartSession("Wed, 25-Dec-02 04:24:20 GMT"); $this->assertEqual(count($jar->getValidCookies(false, "/")), 0); }