You are here

public function HttpCacheTest::testCachesResponsesWithAnExpirationHeader in Zircon Profile 8

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

File

vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php, line 419

Class

HttpCacheTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testCachesResponsesWithAnExpirationHeader() {
  $time = \DateTime::createFromFormat('U', time() + 5);
  $this
    ->setNextResponse(200, array(
    'Cache-Control' => 'public',
    'Expires' => $time
      ->format(DATE_RFC2822),
  ));
  $this
    ->request('GET', '/');
  $this
    ->assertEquals(200, $this->response
    ->getStatusCode());
  $this
    ->assertEquals('Hello World', $this->response
    ->getContent());
  $this
    ->assertNotNull($this->response->headers
    ->get('Date'));
  $this
    ->assertNotNull($this->response->headers
    ->get('X-Content-Digest'));
  $this
    ->assertTraceContains('miss');
  $this
    ->assertTraceContains('store');
  $values = $this
    ->getMetaStorageValues();
  $this
    ->assertCount(1, $values);
}