You are here

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

File

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

Class

HttpCacheTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testEsiCacheForceValidation() {
  $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(
        'ETag' => 'foobar',
      ),
    ),
    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());
  $this
    ->assertNull($this->response
    ->getTtl());
  $this
    ->assertTrue($this->response
    ->mustRevalidate());
  $this
    ->assertTrue($this->response->headers
    ->hasCacheControlDirective('private'));
  $this
    ->assertTrue($this->response->headers
    ->hasCacheControlDirective('no-cache'));
}