Skip to content
Permalink
Browse files

Use new method in responses when getting cookie values.

Refs #11208
  • Loading branch information...
markstory committed Sep 19, 2017
1 parent 56a56a2 commit 6cf84bcb47e3aa3c558dabd03530aa4e88becf0b
Showing with 28 additions and 1 deletion.
  1. +1 −1 src/Http/Response.php
  2. +27 −0 tests/TestCase/Http/ResponseTest.php
@@ -2146,7 +2146,7 @@ protected function convertCookieToArray(CookieInterface $cookie)
{
return [
'name' => $cookie->getName(),
'value' => $cookie->getValue(),
'value' => $cookie->getStringValue(),
'path' => $cookie->getPath(),
'domain' => $cookie->getDomain(),
'secure' => $cookie->isSecure(),
@@ -1577,6 +1577,33 @@ public function testGetCookies()
$this->assertEquals($expected, $new->getCookies());
}
/**
* Test getCookies() and array data.
*
* @return void
*/
public function testGetCookiesArrayValue()
{
$response = new Response();
$cookie = (new Cookie('urmc'))
->withValue(['user_id' => 1, 'token' => 'abc123'])
->withHttpOnly(true);
$new = $response->withCookie($cookie);
$expected = [
'urmc' => [
'name' => 'urmc',
'value' => '{"user_id":1,"token":"abc123"}',
'expire' => null,
'path' => '',
'domain' => '',
'secure' => false,
'httpOnly' => true
],
];
$this->assertEquals($expected, $new->getCookies());
}
/**
* Test getCookieCollection() as array data
*

0 comments on commit 6cf84bc

Please sign in to comment.
You can’t perform that action at this time.