public function EsiTest::testProcessRemoveSurrogateControlHeader

File

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

Class

EsiTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testProcessRemoveSurrogateControlHeader() {
  $esi = new Esi();
  $request = Request::create('/');
  $response = new Response('foo <esi:include src="..." />');
  $response->headers
    ->set('Surrogate-Control', 'content="ESI/1.0"');
  $esi
    ->process($request, $response);
  $this
    ->assertEquals('ESI', $response->headers
    ->get('x-body-eval'));
  $response->headers
    ->set('Surrogate-Control', 'no-store, content="ESI/1.0"');
  $esi
    ->process($request, $response);
  $this
    ->assertEquals('ESI', $response->headers
    ->get('x-body-eval'));
  $this
    ->assertEquals('no-store', $response->headers
    ->get('surrogate-control'));
  $response->headers
    ->set('Surrogate-Control', 'content="ESI/1.0", no-store');
  $esi
    ->process($request, $response);
  $this
    ->assertEquals('ESI', $response->headers
    ->get('x-body-eval'));
  $this
    ->assertEquals('no-store', $response->headers
    ->get('surrogate-control'));
}