The routeTest was incorrect : the SERVER_PORT is a string, not an integer

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1578 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-07-27 09:37:08 +00:00
parent 3a35351199
commit 2f1c06a53a

View File

@@ -9,153 +9,152 @@ class test_route extends PHPUnit_Framework_TestCase
/** Entry null */
public function test_baseURL_1 ()
{
$this->expectOutputString("");
$route = new route ();
$route->baseURL ();
$this->expectOutputString("");
}
/** Port 80 and HTTP without module */
public function test_baseURL_2 ()
{
$this->expectOutputString("http://localhost/");
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 80;
$_SERVER["SERVER_PORT"] = "80";
$_SERVER["SCRIPT_NAME"] = "/index.php";
$route = new route ();
echo $route->baseURL ();
$this->expectOutputString("http://localhost/");
}
/** Port 443 and HTTPS without module */
public function test_baseURL_3 ()
{
$this->expectOutputString("https://localhost/");
unset ($_SERVER["HTTPS"]);
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 443;
$_SERVER["SERVER_PORT"] = "443";
$_SERVER["HTTPS"] = true;
$_SERVER["SCRIPT_NAME"] = "/index.php";
$route = new route ();
echo $route->baseURL ();
$this->expectOutputString("https://localhost/");
}
/** Port 888 and HTTP without module */
public function test_baseURL_4 ()
{
$this->expectOutputString("http://localhost:888/");
unset ($_SERVER["HTTPS"]);
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 888;
$_SERVER["SERVER_PORT"] = "888";
$_SERVER["SCRIPT_NAME"] = "/index.php";
$route = new route ();
echo $route->baseURL ();
$this->expectOutputString("http://localhost:888/");
}
/** Port 888 and HTTPS without module */
public function test_baseURL_5 ()
{
$this->expectOutputString("https://localhost:888/");
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 888;
$_SERVER["SERVER_PORT"] = "888";
$_SERVER["HTTPS"] = true;
$_SERVER["SCRIPT_NAME"] = "/index.php";
$route = new route ();
echo $route->baseURL ();
$this->expectOutputString("https://localhost:888/");
}
/** Port 80 and HTTP with module */
public function test_baseURL_2_module ()
{
$this->expectOutputString("http://localhost/");
unset ($_SERVER["HTTPS"]);
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 80;
$_SERVER["SERVER_PORT"] = "80";
$_SERVER["SCRIPT_NAME"] = "/module/index.php";
$route = new route ();
echo $route->baseURL ("module");
$this->expectOutputString("http://localhost/");
}
/** Port 443 and HTTPS with module */
public function test_baseURL_3_module ()
{
$this->expectOutputString("https://localhost/");
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 443;
$_SERVER["SERVER_PORT"] = "443";
$_SERVER["HTTPS"] = true;
$_SERVER["SCRIPT_NAME"] = "/module/index.php";
$route = new route ();
echo $route->baseURL ("module");
$this->expectOutputString("https://localhost/");
}
/** Port 888 and HTTP with module */
public function test_baseURL_4_module ()
{
$this->expectOutputString("http://localhost:888/");
unset ($_SERVER["HTTPS"]);
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 888;
$_SERVER["SERVER_PORT"] = "888";
$_SERVER["SCRIPT_NAME"] = "/module/index.php";
$route = new route ();
echo $route->baseURL ("module");
$this->expectOutputString("http://localhost:888/");
}
/** Port 888 and HTTPS with module */
public function test_baseURL_5_module ()
{
$this->expectOutputString("https://localhost:888/");
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 888;
$_SERVER["SERVER_PORT"] = "888";
$_SERVER["HTTPS"] = true;
$_SERVER["SCRIPT_NAME"] = "/module/index.php";
$route = new route ();
echo $route->baseURL ("module");
$this->expectOutputString("https://localhost:888/");
}
/** Port 80 and HTTP requestURL */
public function test_requestURL_2 ()
{
$this->expectOutputString("http://localhost/index.php?var=1");
unset ($_SERVER["HTTPS"]);
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 80;
$_SERVER["SERVER_PORT"] = "80";
$_SERVER["REQUEST_URI"] = "/index.php?var=1";
$route = new route ();
echo $route->requestURL ();
$this->expectOutputString("http://localhost/index.php?var=1");
}
/** Port 443 and HTTPS requestURL */
public function test_requestURL_3 ()
{
$this->expectOutputString("https://localhost/index.php?var=1");
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 443;
$_SERVER["SERVER_PORT"] = "443";
$_SERVER["HTTPS"] = true;
$_SERVER["REQUEST_URI"] = "/index.php?var=1";
$route = new route ();
echo $route->requestURL ();
$this->expectOutputString("https://localhost/index.php?var=1");
}
/** Port 888 and HTTP requestURL */
public function test_requestURL_4 ()
{
$this->expectOutputString("http://localhost:888/index.php?var=1");
unset ($_SERVER["HTTPS"]);
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 888;
$_SERVER["SERVER_PORT"] = "888";
$_SERVER["REQUEST_URI"] = "/index.php?var=1";
$route = new route ();
echo $route->requestURL ();
$this->expectOutputString("http://localhost:888/index.php?var=1");
}
/** Port 888 and HTTPS requestURL */
public function test_requestURL_5 ()
{
$this->expectOutputString("https://localhost:888/index.php?var=1");
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["SERVER_PORT"] = 888;
$_SERVER["SERVER_PORT"] = "888";
$_SERVER["HTTPS"] = true;
$_SERVER["REQUEST_URI"] = "/index.php?var=1";
$route = new route ();
echo $route->requestURL ();
$this->expectOutputString("https://localhost:888/index.php?var=1");
}
}