You are here

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

File

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

Class

HttpCacheTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testEsiCacheSendsTheLowestTtl() {
  $responses = array(
    array(
      'status' => 200,
      'body' => '<esi:include src="/foo" /> <esi:include src="/bar" />',
      'headers' => array(
        'Cache-Control' => 's-maxage=300',
        'Surrogate-Control' => 'content="ESI/1.0"',
      ),
    ),
    array(
      'status' => 200,
      'body' => 'Hello World!',
      'headers' => array(
        'Cache-Control' => 's-maxage=300',
      ),
    ),
    array(
      'status' => 200,
      'body' => 'My name is Bobby.',
      'headers' => array(
        'Cache-Control' => 's-maxage=100',
      ),
    ),
  );
  $this
    ->setNextResponses($responses);
  $this
    ->request('GET', '/', array(), array(), true);
  $this
    ->assertEquals('Hello World! My name is Bobby.', $this->response
    ->getContent());

  // check for 100 or 99 as the test can be executed after a second change
  $this
    ->assertTrue(in_array($this->response
    ->getTtl(), array(
    99,
    100,
  )));
}