File
- drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php, line 763
Class
- RequestTest
Namespace
Symfony\Component\HttpFoundation\Tests
Code
public function testOverrideGlobals() {
$request = new Request();
$request
->initialize(array(
'foo' => 'bar',
));
$server = $_SERVER;
$request
->overrideGlobals();
$this
->assertEquals(array(
'foo' => 'bar',
), $_GET);
$request
->initialize(array(), array(
'foo' => 'bar',
));
$request
->overrideGlobals();
$this
->assertEquals(array(
'foo' => 'bar',
), $_POST);
$this
->assertArrayNotHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER);
$this
->startTrustingProxyData();
$request->headers
->set('X_FORWARDED_PROTO', 'https');
$this
->assertTrue($request
->isSecure());
$this
->stopTrustingProxyData();
$request
->overrideGlobals();
$this
->assertArrayHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER);
$_SERVER = $server;
}