public function EsiTest::testProcess

File

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

Class

EsiTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testProcess() {
  $esi = new Esi();
  $request = Request::create('/');
  $response = new Response('foo <esi:comment text="some comment" /><esi:include src="..." alt="alt" onerror="continue" />');
  $esi
    ->process($request, $response);
  $this
    ->assertEquals('foo <?php echo $this->esi->handle($this, \'...\', \'alt\', true) ?>' . "\n", $response
    ->getContent());
  $this
    ->assertEquals('ESI', $response->headers
    ->get('x-body-eval'));
  $response = new Response('foo <esi:include src="..." />');
  $esi
    ->process($request, $response);
  $this
    ->assertEquals('foo <?php echo $this->esi->handle($this, \'...\', \'\', false) ?>' . "\n", $response
    ->getContent());
  $response = new Response('foo <esi:include src="..."></esi:include>');
  $esi
    ->process($request, $response);
  $this
    ->assertEquals('foo <?php echo $this->esi->handle($this, \'...\', \'\', false) ?>' . "\n", $response
    ->getContent());
}