You are here

public function StoreTest::testOverwritesNonVaryingResponseWithStore in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php \Symfony\Component\HttpKernel\Tests\HttpCache\StoreTest::testOverwritesNonVaryingResponseWithStore()

File

vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php, line 202

Class

StoreTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testOverwritesNonVaryingResponseWithStore() {
  $req1 = Request::create('/test', 'get', array(), array(), array(), array(
    'HTTP_FOO' => 'Foo',
    'HTTP_BAR' => 'Bar',
  ));
  $res1 = new Response('test 1', 200, array(
    'Vary' => 'Foo Bar',
  ));
  $key = $this->store
    ->write($req1, $res1);
  $this
    ->assertEquals($this
    ->getStorePath('en' . hash('sha256', 'test 1')), $this->store
    ->lookup($req1)
    ->getContent());
  $req2 = Request::create('/test', 'get', array(), array(), array(), array(
    'HTTP_FOO' => 'Bling',
    'HTTP_BAR' => 'Bam',
  ));
  $res2 = new Response('test 2', 200, array(
    'Vary' => 'Foo Bar',
  ));
  $this->store
    ->write($req2, $res2);
  $this
    ->assertEquals($this
    ->getStorePath('en' . hash('sha256', 'test 2')), $this->store
    ->lookup($req2)
    ->getContent());
  $req3 = Request::create('/test', 'get', array(), array(), array(), array(
    'HTTP_FOO' => 'Foo',
    'HTTP_BAR' => 'Bar',
  ));
  $res3 = new Response('test 3', 200, array(
    'Vary' => 'Foo Bar',
  ));
  $key = $this->store
    ->write($req3, $res3);
  $this
    ->assertEquals($this
    ->getStorePath('en' . hash('sha256', 'test 3')), $this->store
    ->lookup($req3)
    ->getContent());
  $this
    ->assertCount(2, $this
    ->getStoreMetadata($key));
}