public function ResponseTest::testGetVary in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Tests/ResponseTest.php \Symfony\Component\HttpFoundation\Tests\ResponseTest::testGetVary()
File
- vendor/
symfony/ http-foundation/ Tests/ ResponseTest.php, line 397
Class
Namespace
Symfony\Component\HttpFoundation\TestsCode
public function testGetVary() {
$response = new Response();
$this
->assertEquals(array(), $response
->getVary(), '->getVary() returns an empty array if no Vary header is present');
$response = new Response();
$response->headers
->set('Vary', 'Accept-Language');
$this
->assertEquals(array(
'Accept-Language',
), $response
->getVary(), '->getVary() parses a single header name value');
$response = new Response();
$response->headers
->set('Vary', 'Accept-Language User-Agent X-Foo');
$this
->assertEquals(array(
'Accept-Language',
'User-Agent',
'X-Foo',
), $response
->getVary(), '->getVary() parses multiple header name values separated by spaces');
$response = new Response();
$response->headers
->set('Vary', 'Accept-Language,User-Agent, X-Foo');
$this
->assertEquals(array(
'Accept-Language',
'User-Agent',
'X-Foo',
), $response
->getVary(), '->getVary() parses multiple header name values separated by commas');
$vary = array(
'Accept-Language',
'User-Agent',
'X-foo',
);
$response = new Response();
$response->headers
->set('Vary', $vary);
$this
->assertEquals($vary, $response
->getVary(), '->getVary() parses multiple header name values in arrays');
$response = new Response();
$response->headers
->set('Vary', 'Accept-Language, User-Agent, X-foo');
$this
->assertEquals($vary, $response
->getVary(), '->getVary() parses multiple header name values in arrays');
}