You are here

public function HttpCacheTest::testXForwarderForHeaderForForwardedRequests in Zircon Profile 8

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

@dataProvider getXForwardedForData

File

vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php, line 1168

Class

HttpCacheTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testXForwarderForHeaderForForwardedRequests($xForwardedFor, $expected) {
  $this
    ->setNextResponse();
  $server = array(
    'REMOTE_ADDR' => '10.0.0.1',
  );
  if (false !== $xForwardedFor) {
    $server['HTTP_X_FORWARDED_FOR'] = $xForwardedFor;
  }
  $this
    ->request('GET', '/', $server);
  $this
    ->assertEquals($expected, $this->kernel
    ->getBackendRequest()->headers
    ->get('X-Forwarded-For'));
}