[HttpFoundation] renamed hostname to host in the test to be consistent

This commit is contained in:
Fabien Potencier 2013-01-21 17:56:55 +01:00
parent b7614e9ca8
commit 18b9e68861

View File

@ -303,9 +303,9 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$server = array();
// Standard Request on non default PORT
// http://hostname:8080/index.php/path/info?query=string
// http://host:8080/index.php/path/info?query=string
$server['HTTP_HOST'] = 'hostname:8080';
$server['HTTP_HOST'] = 'host:8080';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '8080';
@ -321,16 +321,16 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals('http://hostname:8080/index.php/path/info?query=string', $request->getUri(), '->getUri() with non default port');
$this->assertEquals('http://host:8080/index.php/path/info?query=string', $request->getUri(), '->getUri() with non default port');
// Use std port number
$server['HTTP_HOST'] = 'hostname';
$server['HTTP_HOST'] = 'host';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals('http://hostname/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port');
$this->assertEquals('http://host/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port');
// Without HOST HEADER
unset($server['HTTP_HOST']);
@ -344,9 +344,9 @@ class RequestTest extends \PHPUnit_Framework_TestCase
// Request with URL REWRITING (hide index.php)
// RewriteCond %{REQUEST_FILENAME} !-f
// RewriteRule ^(.*)$ index.php [QSA,L]
// http://hostname:8080/path/info?query=string
// http://host:8080/path/info?query=string
$server = array();
$server['HTTP_HOST'] = 'hostname:8080';
$server['HTTP_HOST'] = 'host:8080';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '8080';
@ -360,17 +360,17 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$server['SCRIPT_FILENAME'] = '/some/where/index.php';
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals('http://hostname:8080/path/info?query=string', $request->getUri(), '->getUri() with rewrite');
$this->assertEquals('http://host:8080/path/info?query=string', $request->getUri(), '->getUri() with rewrite');
// Use std port number
// http://hostname/path/info?query=string
$server['HTTP_HOST'] = 'hostname';
// http://host/path/info?query=string
$server['HTTP_HOST'] = 'host';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals('http://hostname/path/info?query=string', $request->getUri(), '->getUri() with rewrite and default port');
$this->assertEquals('http://host/path/info?query=string', $request->getUri(), '->getUri() with rewrite and default port');
// Without HOST HEADER
unset($server['HTTP_HOST']);
@ -384,7 +384,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
// With encoded characters
$server = array(
'HTTP_HOST' => 'hostname:8080',
'HTTP_HOST' => 'host:8080',
'SERVER_NAME' => 'servername',
'SERVER_PORT' => '8080',
'QUERY_STRING' => 'query=string',
@ -398,7 +398,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals(
'http://hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string',
'http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string',
$request->getUri()
);
@ -406,11 +406,11 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$server['PHP_AUTH_USER'] = 'fabien';
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals('http://hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri());
$this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri());
$server['PHP_AUTH_PW'] = 'symfony';
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals('http://hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri());
$this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri());
}
/**
@ -433,9 +433,9 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$server = array();
// Standard Request on non default PORT
// http://hostname:8080/index.php/path/info?query=string
// http://host:8080/index.php/path/info?query=string
$server['HTTP_HOST'] = 'hostname:8080';
$server['HTTP_HOST'] = 'host:8080';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '8080';
@ -451,16 +451,16 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$request->initialize(array(), array(), array(), array(), array(),$server);
$this->assertEquals('http://hostname:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port');
$this->assertEquals('http://host:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port');
// Use std port number
$server['HTTP_HOST'] = 'hostname';
$server['HTTP_HOST'] = 'host';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals('http://hostname/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port');
$this->assertEquals('http://host/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port');
// Without HOST HEADER
unset($server['HTTP_HOST']);
@ -474,9 +474,9 @@ class RequestTest extends \PHPUnit_Framework_TestCase
// Request with URL REWRITING (hide index.php)
// RewriteCond %{REQUEST_FILENAME} !-f
// RewriteRule ^(.*)$ index.php [QSA,L]
// http://hostname:8080/path/info?query=string
// http://host:8080/path/info?query=string
$server = array();
$server['HTTP_HOST'] = 'hostname:8080';
$server['HTTP_HOST'] = 'host:8080';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '8080';
@ -490,17 +490,17 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$server['SCRIPT_FILENAME'] = '/some/where/index.php';
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals('http://hostname:8080/some/path', $request->getUriForPath('/some/path'), '->getUri() with rewrite');
$this->assertEquals('http://host:8080/some/path', $request->getUriForPath('/some/path'), '->getUri() with rewrite');
// Use std port number
// http://hostname/path/info?query=string
$server['HTTP_HOST'] = 'hostname';
// http://host/path/info?query=string
$server['HTTP_HOST'] = 'host';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
$request->initialize(array(), array(), array(), array(), array(), $server);
$this->assertEquals('http://hostname/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite and default port');
$this->assertEquals('http://host/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite and default port');
// Without HOST HEADER
unset($server['HTTP_HOST']);