summaryrefslogtreecommitdiff
path: root/tests/it_url.testserver.php
diff options
context:
space:
mode:
authorNathan Gass2012-10-15 16:16:44 +0000
committerNathan Gass2012-10-15 16:16:44 +0000
commit87587774e477cdeb9b1dd3580ebb55d86db182e8 (patch)
tree10e5c67cd477afde8014bce0b50c6b9243c4d6ae /tests/it_url.testserver.php
parent2efc485bc24fd66938d3eb5feb542ed4279a9501 (diff)
downloaditools-87587774e477cdeb9b1dd3580ebb55d86db182e8.tar.gz
itools-87587774e477cdeb9b1dd3580ebb55d86db182e8.tar.bz2
itools-87587774e477cdeb9b1dd3580ebb55d86db182e8.zip
use switch statement, also fixes illegal style
Diffstat (limited to 'tests/it_url.testserver.php')
-rw-r--r--tests/it_url.testserver.php31
1 files changed, 19 insertions, 12 deletions
diff --git a/tests/it_url.testserver.php b/tests/it_url.testserver.php
index c9c5dff..12ce892 100644
--- a/tests/it_url.testserver.php
+++ b/tests/it_url.testserver.php
@@ -3,19 +3,26 @@ require '/www/server/phpinclude/auto_prepend.php';
$stderr = fopen('php://stderr', 'w');
fwrite($stderr, "Got Request: '" . $_SERVER['REQUEST_URI'] . "'\n");
-if ($_SERVER['PHP_SELF'] == "/") {
- echo 'Testserver root output';
+switch ($_SERVER['PHP_SELF'])
+{
+ case "/":
+ echo 'Testserver root output';
+ break;
+
+ case "/temp_redirect":
+ it_url::redirect(U("redirect_target", array('type' => 'temporary')), 'temporary');
+ break;
-} else if ($_SERVER['PHP_SELF'] == "/temp_redirect") {
- it_url::redirect(U("redirect_target", array('type' => 'temporary')), 'temporary');
+ case "/perm_redirect":
+ it_url::redirect(U("redirect_target", array('type' => 'permanent')), 'permanent');
+ break;
-} else if ($_SERVER['PHP_SELF'] == "/perm_redirect") {
- it_url::redirect(U("redirect_target", array('type' => 'permanent')), 'permanent');
+ case "/redirect_loop":
+ if ($_REQUEST['num'] > 0)
+ it_url::redirect(U("redirect_loop", array('num' => $_REQUEST['num'] - 1)));
+ break;
-} else if ($_SERVER['PHP_SELF'] == "/redirect_loop") {
- if ($_REQUEST['num'] > 0)
- it_url::redirect(U("redirect_loop", array('num' => $_REQUEST['num'] - 1)));
-
-} else if ($_SERVER['PHP_SELF'] == "/redirect_target") {
- echo 'Testserver output after ' . $_REQUEST['type'] . ' redirect';
+ case "/redirect_target":
+ echo 'Testserver output after ' . $_REQUEST['type'] . ' redirect';
+ break;
}