Skip to content

Commit

Permalink
[HttpFoundation] renamed hostname to host in the test to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 21, 2013
1 parent b7614e9 commit 18b9e68
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Expand Up @@ -303,9 +303,9 @@ public function testGetUri()
$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';

Expand All @@ -321,16 +321,16 @@ public function testGetUri()

$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']);
Expand All @@ -344,9 +344,9 @@ public function testGetUri()
// 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';

Expand All @@ -360,17 +360,17 @@ public function testGetUri()
$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']);
Expand All @@ -384,7 +384,7 @@ public function testGetUri()
// With encoded characters

$server = array(
'HTTP_HOST' => 'hostname:8080',
'HTTP_HOST' => 'host:8080',
'SERVER_NAME' => 'servername',
'SERVER_PORT' => '8080',
'QUERY_STRING' => 'query=string',
Expand All @@ -398,19 +398,19 @@ public function testGetUri()
$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()
);

// with user info

$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());
}

/**
Expand All @@ -433,9 +433,9 @@ public function testGetUriForPath()
$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';

Expand All @@ -451,16 +451,16 @@ public function testGetUriForPath()

$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']);
Expand All @@ -474,9 +474,9 @@ public function testGetUriForPath()
// 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';

Expand All @@ -490,17 +490,17 @@ public function testGetUriForPath()
$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']);
Expand Down

0 comments on commit 18b9e68

Please sign in to comment.