18 $response = $this->prophesize(static::INTERFACE_PSR_HTTP_MESSAGE_RESPONSE);
23 $this->assertEquals($expectedSetCookies, $setCookies->getAll());
37 $this->assertEquals($expectedSetCookies, $setCookies->getAll());
51 foreach ($expectedSetCookies as $expectedSetCookie) {
52 $this->assertTrue($setCookies->has($expectedSetCookie->getName()));
55 $this->assertFalse($setCookies->has(
'i know this cookie does not exist'));
66 $this->assertEquals($expectedSetCookie, $setCookies->get($setCookieName));
76 ->without(
'sessionToken')
81 $response = $setCookies->renderIntoSetCookieHeader($originalResponse);
83 $this->assertNotEquals(
$response, $originalResponse);
86 [
'theme=blue',
'hello=world',
'who=me'],
114 $decryptedSessionToken = $setCookies->get(
'sessionToken');
117 $decryptedValue = $decryptedSessionToken->getValue();
118 $encryptedValue = str_rot13($decryptedValue);
121 $encryptedSessionToken = $decryptedSessionToken->withValue($encryptedValue);
124 $setCookies = $setCookies->with($encryptedSessionToken);
132 [
'theme=light',
'sessionToken=RAPELCGRQ',
'hello=world'],
154 'someCookie=someValue',
155 'LSID=DQAAAK%2FEaem_vYg; Path=/accounts; Expires=Wed, 13 Jan 2021 22:23:01 GMT; Secure; HttpOnly',
160 ->withValue(
'DQAAAK/Eaem_vYg')
161 ->withPath(
'/accounts')
162 ->withExpires(
'Wed, 13 Jan 2021 22:23:01 GMT')
164 ->withHttpOnly(
true),
199 'LSID=DQAAAK%2FEaem_vYg; Path=/accounts; Expires=Wed, 13 Jan 2021 22:23:01 GMT; Secure; HttpOnly',
203 ->withValue(
'DQAAAK/Eaem_vYg')
204 ->withPath(
'/accounts')
205 ->withExpires(
'Wed, 13 Jan 2021 22:23:01 GMT')
207 ->withHttpOnly(
true),
it_gets_and_updates_set_cookie_value_on_request()
it_knows_which_set_cookies_are_available($setCookieStrings, array $expectedSetCookies)
it_creates_from_set_cookie_strings($setCookieStrings, array $expectedSetCookies)
provideGetsSetCookieByNameData()
static fromResponse(ResponseInterface $response)
Create SetCookies from a Response.
static fromSetCookieStrings($setCookieStrings)
Create SetCookies from a collection of SetCookie header value strings.
static create($name, $value=null)
provideSetCookieStringsAndExpectedSetCookiesData()
const SET_COOKIE_HEADER
The name of the Set-Cookie header.
const INTERFACE_PSR_HTTP_MESSAGE_RESPONSE
it_gets_set_cookie_by_name($setCookieStrings, $setCookieName, SetCookie $expectedSetCookie=null)
it_renders_added_and_removed_set_cookies_header()
it_creates_from_response($setCookieStrings, array $expectedSetCookies)
withAddedHeader($name, $value)