$this->
assertTrue($bag->
hasCacheControlDirective('no-cache'
));
} public function testCookiesWithSameNames() { $bag =
new ResponseHeaderBag();
$bag->
setCookie(Cookie::
create('foo', 'bar', 0, '/path/foo', 'foo.bar'
));
$bag->
setCookie(Cookie::
create('foo', 'bar', 0, '/path/bar', 'foo.bar'
));
$bag->
setCookie(Cookie::
create('foo', 'bar', 0, '/path/bar', 'bar.foo'
));
$bag->
setCookie(Cookie::
create('foo', 'bar'
));
$this->
assertCount(4,
$bag->
getCookies());
$this->
assertEquals('foo=bar; path=/path/foo; domain=foo.bar; httponly; samesite=lax',
$bag->
get('set-cookie'
));
$this->
assertEquals([ 'foo=bar; path=/path/foo; domain=foo.bar; httponly; samesite=lax',
'foo=bar; path=/path/bar; domain=foo.bar; httponly; samesite=lax',
'foo=bar; path=/path/bar; domain=bar.foo; httponly; samesite=lax',
'foo=bar; path=/; httponly; samesite=lax',
],
$bag->
all('set-cookie'
));
$this->
assertSetCookieHeader('foo=bar; path=/path/foo; domain=foo.bar; httponly; samesite=lax',
$bag);
$this->
assertSetCookieHeader('foo=bar; path=/path/bar; domain=foo.bar; httponly; samesite=lax',
$bag);
$this->
assertSetCookieHeader('foo=bar; path=/path/bar; domain=bar.foo; httponly; samesite=lax',
$bag);