Example #1
0
 /**
  * Test explicit expire on a non expired cookie
  */
 public function testHttpCookieExplicitExpireOnANonExpiredCookie()
 {
     $hash = md5(time());
     $dateTime = new \DateTime();
     // let it expire to be 1 hour in the future
     $dateTime->modify("+1 hour");
     // init parser
     $cookie = new HttpCookie('testCookieName001', $hash, $dateTime, null, 'testdomain.local', '/', false, true);
     // should not be expired
     $this->assertSame($cookie->isExpired(), false);
     // let the cookie expire
     $cookie->expire();
     // now it should be expired
     $this->assertSame($cookie->isExpired(), true);
 }