You are here

public function HttpCacheTest::testRespondsWith304WhenIfModifiedSinceMatchesLastModified 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::testRespondsWith304WhenIfModifiedSinceMatchesLastModified()

File

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

Class

HttpCacheTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testRespondsWith304WhenIfModifiedSinceMatchesLastModified() {
  $time = new \DateTime();
  $this
    ->setNextResponse(200, array(
    'Cache-Control' => 'public',
    'Last-Modified' => $time
      ->format(DATE_RFC2822),
    'Content-Type' => 'text/plain',
  ), 'Hello World');
  $this
    ->request('GET', '/', array(
    'HTTP_IF_MODIFIED_SINCE' => $time
      ->format(DATE_RFC2822),
  ));
  $this
    ->assertHttpKernelIsCalled();
  $this
    ->assertEquals(304, $this->response
    ->getStatusCode());
  $this
    ->assertEquals('', $this->response->headers
    ->get('Content-Type'));
  $this
    ->assertEmpty($this->response
    ->getContent());
  $this
    ->assertTraceContains('miss');
  $this
    ->assertTraceContains('store');
}