18 $request = $this->prophesize(static::INTERFACE_PSR_HTTP_MESSAGE_REQUEST);
23 $this->assertEquals($expectedCookies, $cookies->getAll());
37 $this->assertEquals($expectedCookies, $cookies->getAll());
51 foreach ($expectedCookies as $expectedCookie) {
52 $this->assertTrue($cookies->has($expectedCookie->getName()));
55 $this->assertFalse($cookies->has(
'i know this cookie does not exist'));
66 $this->assertEquals($expectedCookie, $cookies->get(
$cookieName));
78 $this->assertEquals(
'blue', $cookies->get(
'theme')->getValue());
82 $this->assertEquals(
'red', $cookies->get(
'theme')->getValue());
84 $cookies = $cookies->without(
'theme');
86 $this->assertFalse($cookies->has(
'theme'));
100 $request = $cookies->renderIntoCookieHeader($originalRequest);
102 $this->assertNotEquals(
$request, $originalRequest);
114 ->without(
'sessionToken')
119 $request = $cookies->renderIntoCookieHeader($originalRequest);
121 $this->assertNotEquals(
$request, $originalRequest);
142 $this->assertEquals(
'light', $theme);
166 $encryptedSessionToken = $cookies->get(
'sessionToken');
169 $encryptedValue = $encryptedSessionToken->getValue();
170 $decryptedValue = str_rot13($encryptedValue);
173 $decryptedSessionToken = $encryptedSessionToken->withValue($decryptedValue);
176 $cookies = $cookies->with($decryptedSessionToken);
184 'theme=light; sessionToken=ENCRYPTED; hello=world',
203 'theme=light; sessionToken=abc123',
217 [
'hello=world; theme=light; sessionToken=abc123',
'theme',
Cookie::create(
'theme',
'light')],
218 [
'hello=world; theme=; sessionToken=abc123',
'theme',
Cookie::create(
'theme')],
static fromCookieString($string)
Create Cookies from a Cookie header value string.
static create($name, $value=null)
Create a Cookie.
foreach($paths as $path) $request
it_gets_cookie_value_from_request()
it_creates_from_cookie_string($cookieString, array $expectedCookies)
const INTERFACE_PSR_HTTP_MESSAGE_REQUEST
it_knows_which_cookies_are_available($cookieString, array $expectedCookies)
it_renders_added_and_removed_cookies_header()
it_gets_and_updates_cookie_value_on_request()
provideCookieStringAndExpectedCookiesData()
it_gets_cookie_by_name($cookieString, $cookieName, Cookie $expectedCookie)
it_creates_from_request($cookieString, array $expectedCookies)
const COOKIE_HEADER
The name of the Cookie header.
withHeader($name, $value)
it_sets_overrides_and_removes_cookie()
it_renders_new_cookies_into_empty_cookie_header()
static fromRequest(RequestInterface $request)
Create Cookies from a Request.
provideGetsCookieByNameData()