You are here

public function EsiTest::testProcess in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php \Symfony\Component\HttpKernel\Tests\HttpCache\EsiTest::testProcess()

File

vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php, line 117

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->surrogate->handle($this, \'...\', \'alt\', true) ?>' . "\n", $response
    ->getContent());
  $this
    ->assertEquals('ESI', $response->headers
    ->get('x-body-eval'));
  $response = new Response('foo <esi:comment text="some comment" /><esi:include src="foo\'" alt="bar\'" onerror="continue" />');
  $esi
    ->process($request, $response);
  $this
    ->assertEquals('foo <?php echo $this->surrogate->handle($this, \'foo\\\'\', \'bar\\\'\', true) ?>' . "\n", $response
    ->getContent());
  $response = new Response('foo <esi:include src="..." />');
  $esi
    ->process($request, $response);
  $this
    ->assertEquals('foo <?php echo $this->surrogate->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->surrogate->handle($this, \'...\', \'\', false) ?>' . "\n", $response
    ->getContent());
}