You are here

public function InlineFragmentRendererTest::testESIHeaderIsKeptInSubrequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php \Symfony\Component\HttpKernel\Tests\Fragment\InlineFragmentRendererTest::testESIHeaderIsKeptInSubrequest()
1 call to InlineFragmentRendererTest::testESIHeaderIsKeptInSubrequest()
InlineFragmentRendererTest::testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled in vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php

File

vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php, line 174

Class

InlineFragmentRendererTest

Namespace

Symfony\Component\HttpKernel\Tests\Fragment

Code

public function testESIHeaderIsKeptInSubrequest() {
  $expectedSubRequest = Request::create('/');
  $expectedSubRequest->headers
    ->set('Surrogate-Capability', 'abc="ESI/1.0"');
  if (Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)) {
    $expectedSubRequest->headers
      ->set('x-forwarded-for', array(
      '127.0.0.1',
    ));
    $expectedSubRequest->server
      ->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
  }
  $strategy = new InlineFragmentRenderer($this
    ->getKernelExpectingRequest($expectedSubRequest));
  $request = Request::create('/');
  $request->headers
    ->set('Surrogate-Capability', 'abc="ESI/1.0"');
  $strategy
    ->render('/', $request);
}