Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 1b0ba2b

Browse files
author
Thomas Flori
committed
added a test
1 parent 1b1ec69 commit 1b0ba2b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/CookiesTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Zend\Http\Response;
1414
use Zend\Http\Headers;
1515
use Zend\Http\Cookies;
16+
use Zend\Http\PhpEnvironment\Request;
1617

1718
class CookiesTest extends \PHPUnit_Framework_TestCase
1819
{
@@ -43,4 +44,20 @@ public function testFromResponseInCookie()
4344
$response = Cookies::fromResponse($response, "http://www.zend.com");
4445
$this->assertSame($header, $response->getCookie('http://www.zend.com', 'foo'));
4546
}
47+
48+
public function testRequestCanHaveArrayCookies()
49+
{
50+
// this happens wich cookie header: "test[a]=value_a&test[b]=value_b"
51+
$_COOKIE = [
52+
'test' => [
53+
'a' => 'value_a',
54+
'b' => 'value_b'
55+
]
56+
];
57+
$request = new Request();
58+
59+
$fieldValue = $request->getCookie('test')->getFieldValue();
60+
61+
$this->assertSame('test[a]=value_a; test[b]=value_b', $fieldValue);
62+
}
4663
}

0 commit comments

Comments
 (0)