[HttpFoundation] Fix Cookie::isCleared
This commit is contained in:
parent
a57549d0a1
commit
d3d7766874
@ -183,6 +183,6 @@ class Cookie
|
||||
*/
|
||||
public function isCleared()
|
||||
{
|
||||
return $this->expire < time();
|
||||
return 0 !== $this->expire && $this->expire < time();
|
||||
}
|
||||
}
|
||||
|
@ -153,6 +153,18 @@ class CookieTest extends TestCase
|
||||
$cookie = new Cookie('foo', 'bar', time() - 20);
|
||||
|
||||
$this->assertTrue($cookie->isCleared(), '->isCleared() returns true if the cookie has expired');
|
||||
|
||||
$cookie = new Cookie('foo', 'bar');
|
||||
|
||||
$this->assertFalse($cookie->isCleared());
|
||||
|
||||
$cookie = new Cookie('foo', 'bar', 0);
|
||||
|
||||
$this->assertFalse($cookie->isCleared());
|
||||
|
||||
$cookie = new Cookie('foo', 'bar', -1);
|
||||
|
||||
$this->assertFalse($cookie->isCleared());
|
||||
}
|
||||
|
||||
public function testToString()
|
||||
|
Reference in New Issue
Block a user