$bag =
new ResponseHeaderBag();
$this->
assertFalse($bag->
has('set-cookie'
));
$bag->
setCookie(Cookie::
create('foo', 'bar', 0, '/path/foo', 'foo.bar'
));
$bag->
setCookie(Cookie::
create('bar', 'foo', 0, '/path/bar', 'foo.bar'
));
$this->
assertTrue($bag->
has('set-cookie'
));
$cookies =
$bag->
getCookies(ResponseHeaderBag::COOKIES_ARRAY
);
$this->
assertArrayHasKey('/path/foo',
$cookies['foo.bar'
]);
$bag->
removeCookie('foo', '/path/foo', 'foo.bar'
);
$this->
assertTrue($bag->
has('set-cookie'
));
$cookies =
$bag->
getCookies(ResponseHeaderBag::COOKIES_ARRAY
);
$this->
assertArrayNotHasKey('/path/foo',
$cookies['foo.bar'
]);
$bag->
removeCookie('bar', '/path/bar', 'foo.bar'
);
$this->
assertFalse($bag->
has('set-cookie'
));
$cookies =
$bag->
getCookies(ResponseHeaderBag::COOKIES_ARRAY
);
$this->
assertArrayNotHasKey('foo.bar',
$cookies);
}