public function HttpCacheTest::testDoesNotCacheSomeStatusCodeResponses

File

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

Class

HttpCacheTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testDoesNotCacheSomeStatusCodeResponses() {
  foreach (array_merge(range(201, 202), range(204, 206), range(303, 305), range(400, 403), range(405, 409), range(411, 417), range(500, 505)) as $code) {
    $time = \DateTime::createFromFormat('U', time() + 5);
    $this
      ->setNextResponse($code, array(
      'Expires' => $time
        ->format(DATE_RFC2822),
    ));
    $this
      ->request('GET', '/');
    $this
      ->assertEquals($code, $this->response
      ->getStatusCode());
    $this
      ->assertTraceNotContains('store');
    $this
      ->assertFalse($this->response->headers
      ->has('Age'));
  }
}