public function ResponseTest::testSetVary

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php, line 177

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',
  ), $response
    ->getVary(), '->setVary() doesn\'t change the Vary header if replace is set to false');
}