clearCookie() public method

Clears a cookie in the browser.
public clearCookie ( string $name, string $path = '/', string $domain = null, boolean $secure = false, boolean $httpOnly = true )
$name string
$path string
$domain string
$secure boolean
$httpOnly boolean
 public function testToStringIncludesCookieHeaders()
 {
     $bag = new ResponseHeaderBag(array());
     $bag->setCookie(new Cookie('foo', 'bar'));
     $this->assertContains("Set-Cookie: foo=bar; path=/; httponly", explode("\r\n", $bag->__toString()));
     $bag->clearCookie('foo');
     $this->assertContains("Set-Cookie: foo=deleted; expires=" . gmdate("D, d-M-Y H:i:s T", time() - 31536001) . "; httponly", explode("\r\n", $bag->__toString()));
 }
 public function testClearCookieSecureNotHttpOnly()
 {
     $bag = new ResponseHeaderBag(array());
     $bag->clearCookie('foo', '/', null, true, false);
     $this->assertRegExp('#^Set-Cookie: foo=deleted; expires=' . gmdate('D, d-M-Y H:i:s T', time() - 31536001) . '; path=/; secure#m', $bag->__toString());
 }
 public function testClearCookieSecureNotHttpOnly()
 {
     $bag = new ResponseHeaderBag(array());
     $bag->clearCookie('foo', '/', null, true, false);
     $this->assertContains("Set-Cookie: foo=deleted; expires=" . gmdate("D, d-M-Y H:i:s T", time() - 31536001) . "; path=/; secure", explode("\r\n", $bag->__toString()));
 }
示例#4
0
    public function testClearCookieSecureNotHttpOnly()
    {
        $bag = new ResponseHeaderBag(array());

        $bag->clearCookie('foo', '/', null, true, false);

        $this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001; path=/; secure', $bag);
    }