merged branch fturmel/patch-1 (PR #9038)

This PR was submitted for the 2.3 branch but it was merged into the 2.2 branch instead (closes #9038).

Discussion
----------

HttpFoundation Request : unit test to confirm #8619 issue fix

Commits
-------

ae4925b HttpFoundation RequestTest - Fixed indentation and removed comments
94ea510 HttpFoundation Request test for #8619
This commit is contained in:
Fabien Potencier 2013-09-16 10:00:14 +02:00
commit 6a17a39fcb
1 changed files with 19 additions and 0 deletions

View File

@ -726,6 +726,25 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$port = $request->getPort();
$this->assertEquals(80, $port, 'If X_FORWARDED_PROTO is set to http return 80.');
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
'HTTP_X_FORWARDED_PROTO' => 'On'
));
$port = $request->getPort();
$this->assertEquals(443, $port, 'With only PROTO set and value is On, getPort() defaults to 443.');
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
'HTTP_X_FORWARDED_PROTO' => '1'
));
$port = $request->getPort();
$this->assertEquals(443, $port, 'With only PROTO set and value is 1, getPort() defaults to 443.');
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
'HTTP_X_FORWARDED_PROTO' => 'something-else'
));
$port = $request->getPort();
$this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.');
Request::setTrustedProxies(array());
}