You are here

public function ResponseHeaderBagTest::testRemoveCookie in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php \Symfony\Component\HttpFoundation\Tests\ResponseHeaderBagTest::testRemoveCookie()

File

vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php, line 191

Class

ResponseHeaderBagTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testRemoveCookie() {
  $bag = new ResponseHeaderBag();
  $bag
    ->setCookie(new Cookie('foo', 'bar', 0, '/path/foo', 'foo.bar'));
  $bag
    ->setCookie(new Cookie('bar', 'foo', 0, '/path/bar', 'foo.bar'));
  $cookies = $bag
    ->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
  $this
    ->assertTrue(isset($cookies['foo.bar']['/path/foo']));
  $bag
    ->removeCookie('foo', '/path/foo', 'foo.bar');
  $cookies = $bag
    ->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
  $this
    ->assertFalse(isset($cookies['foo.bar']['/path/foo']));
  $bag
    ->removeCookie('bar', '/path/bar', 'foo.bar');
  $cookies = $bag
    ->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
  $this
    ->assertFalse(isset($cookies['foo.bar']));
}