You are here

public function HttpCacheTest::testRespondsWith304WhenIfNoneMatchMatchesETag in Zircon Profile 8.0

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

File

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

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');
}