function testCookieClearByDate()
 {
     $jar = new CookieJar();
     $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);
 }
示例#2
0
 function testCookieClearing()
 {
     $jar = new CookieJar();
     $jar->setCookie(new SimpleCookie("a", "abc", "/"));
     $jar->setCookie(new SimpleCookie("a", "", "/"));
     $this->assertEqual(count($cookies = $jar->getValidCookies(false, "/")), 1);
     $this->assertIdentical($cookies[0]->getValue(), "");
 }