public function HttpCacheTest::testRespondsWith304WhenIfNoneMatchMatchesETag

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php, line 154

Class

HttpCacheTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testRespondsWith304WhenIfNoneMatchMatchesETag() {
  $this
    ->setNextResponse(200, array(
    'Cache-Control' => 'public',
    'ETag' => '12345',
    'Content-Type' => 'text/plain',
  ), 'Hello World');
  $this
    ->request('GET', '/', array(
    'HTTP_IF_NONE_MATCH' => '12345',
  ));
  $this
    ->assertHttpKernelIsCalled();
  $this
    ->assertEquals(304, $this->response
    ->getStatusCode());
  $this
    ->assertEquals('', $this->response->headers
    ->get('Content-Type'));
  $this
    ->assertTrue($this->response->headers
    ->has('ETag'));
  $this
    ->assertEmpty($this->response
    ->getContent());
  $this
    ->assertTraceContains('miss');
  $this
    ->assertTraceContains('store');
}