public function ClientTest::testFilterResponseConvertsCookies in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Tests/ClientTest.php \Symfony\Component\HttpKernel\Tests\ClientTest::testFilterResponseConvertsCookies()
File
- vendor/
symfony/ http-kernel/ Tests/ ClientTest.php, line 51
Class
Namespace
Symfony\Component\HttpKernel\TestsCode
public function testFilterResponseConvertsCookies() {
$client = new Client(new TestHttpKernel());
$r = new \ReflectionObject($client);
$m = $r
->getMethod('filterResponse');
$m
->setAccessible(true);
$expected = array(
'foo=bar; expires=Sun, 15 Feb 2009 20:00:00 GMT; domain=http://example.com; path=/foo; secure; httponly',
'foo1=bar1; expires=Sun, 15 Feb 2009 20:00:00 GMT; domain=http://example.com; path=/foo; secure; httponly',
);
$response = new Response();
$response->headers
->setCookie(new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')
->format('U'), '/foo', 'http://example.com', true, true));
$domResponse = $m
->invoke($client, $response);
$this
->assertEquals($expected[0], $domResponse
->getHeader('Set-Cookie'));
$response = new Response();
$response->headers
->setCookie(new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')
->format('U'), '/foo', 'http://example.com', true, true));
$response->headers
->setCookie(new Cookie('foo1', 'bar1', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')
->format('U'), '/foo', 'http://example.com', true, true));
$domResponse = $m
->invoke($client, $response);
$this
->assertEquals($expected[0], $domResponse
->getHeader('Set-Cookie'));
$this
->assertEquals($expected, $domResponse
->getHeader('Set-Cookie', false));
}