public function HttpCacheTest::testEsiCacheForceValidation

File

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

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'));
}