public function HttpCacheTest::testAssignsDefaultTtlWhenResponseHasNoFreshnessInformation

File

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

Class

HttpCacheTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformation() {
  $this
    ->setNextResponse();
  $this->cacheConfig['default_ttl'] = 10;
  $this
    ->request('GET', '/');
  $this
    ->assertHttpKernelIsCalled();
  $this
    ->assertTraceContains('miss');
  $this
    ->assertTraceContains('store');
  $this
    ->assertEquals('Hello World', $this->response
    ->getContent());
  $this
    ->assertRegExp('/s-maxage=10/', $this->response->headers
    ->get('Cache-Control'));
  $this->cacheConfig['default_ttl'] = 10;
  $this
    ->request('GET', '/');
  $this
    ->assertHttpKernelIsNotCalled();
  $this
    ->assertEquals(200, $this->response
    ->getStatusCode());
  $this
    ->assertTraceContains('fresh');
  $this
    ->assertTraceNotContains('store');
  $this
    ->assertEquals('Hello World', $this->response
    ->getContent());
}