$expected = 'foo=bar; path=/; httponly; samesite=lax';
$cookie = Cookie::
create('foo', 'bar'
);
$this->
assertEquals($expected,
(string) $cookie);
$cookie = Cookie::
create('foo'
)->
withValue('bar'
);
$this->
assertEquals($expected,
(string) $cookie);
} public function testRawCookie() { $cookie = Cookie::
create('foo', 'b a r', 0, '/', null, false, false, false, null
);
$this->
assertFalse($cookie->
isRaw());
$this->
assertEquals('foo=b%20a%20r; path=/',
(string) $cookie);
$cookie = Cookie::
create('test'
)->
withValue('t e s t'
)->
withHttpOnly(false
)->
withSameSite(null
);
$this->
assertFalse($cookie->
isRaw());
$this->
assertEquals('test=t%20e%20s%20t; path=/',
(string) $cookie);
$cookie = Cookie::
create('foo', 'b+a+r', 0, '/', null, false, false, true, null
);
$this->
assertTrue($cookie->
isRaw());
$this->
assertEquals('foo=b+a+r; path=/',
(string) $cookie);
$cookie = Cookie::
create('foo'
)