You are here

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

File

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

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());
  $this
    ->assertRegExp('/s-maxage=10/', $this->response->headers
    ->get('Cache-Control'));
}