You are here

public function ResponseTest::testSetVary in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/ResponseTest.php \Symfony\Component\HttpFoundation\Tests\ResponseTest::testSetVary()

File

vendor/symfony/http-foundation/Tests/ResponseTest.php, line 425

Class

ResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testSetVary() {
  $response = new Response();
  $response
    ->setVary('Accept-Language');
  $this
    ->assertEquals(array(
    'Accept-Language',
  ), $response
    ->getVary());
  $response
    ->setVary('Accept-Language, User-Agent');
  $this
    ->assertEquals(array(
    'Accept-Language',
    'User-Agent',
  ), $response
    ->getVary(), '->setVary() replace the vary header by default');
  $response
    ->setVary('X-Foo', false);
  $this
    ->assertEquals(array(
    'Accept-Language',
    'User-Agent',
    'X-Foo',
  ), $response
    ->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false');
}