function testExpiryFilterByAgeing() { $jar = new SimpleCookieJar(); $jar->setCookie('a', 'A', false, '/', 'Wed, 25-Dec-02 04:24:20 GMT'); $jar->restartSession("Wed, 25-Dec-02 04:24:19 GMT"); $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array('a=A')); $jar->agePrematurely(2); $jar->restartSession("Wed, 25-Dec-02 04:24:19 GMT"); $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array()); }
function testExpiryFilterByAgeing() { $cookie = new SimpleCookie("a", "A", "/", "Wed, 25-Dec-02 04:24:20 GMT"); $jar = new SimpleCookieJar(); $jar->setCookie($cookie); $jar->restartSession("Wed, 25-Dec-02 04:24:19 GMT"); $this->assertIdentical($list = $jar->getValidCookies(false, "/"), array($cookie)); $jar->agePrematurely(2); $jar->restartSession("Wed, 25-Dec-02 04:24:19 GMT"); $this->assertIdentical($list = $jar->getValidCookies(false, "/"), array()); }