diff options
-rwxr-xr-x | tests/it_url.t | 26 | ||||
-rw-r--r-- | tests/it_url.testserver.php | 4 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/it_url.t b/tests/it_url.t index 9b9020c..de1cd0b 100755 --- a/tests/it_url.t +++ b/tests/it_url.t @@ -206,6 +206,32 @@ $res2 = ok( if (!$res || !$res2) diag($output); +$res = is( + it_url::get(U('http://localhost:8000/get_server_value', 'key' => 'HTTP_HOST')), + 'localhost:8000', + 'TODO it_url::get() sets correct Host header', +); +$output = server_output(); +if (!$res) + diag($output); + +$res = is( + it_url::get(U('http://localhost:8000/get_server_value', 'key' => 'HTTP_ACCEPT_LANGUAGE')), + T_lang(), + 'it_url::get() sets correct Accept-Language header', +); +$output = server_output(); +if (!$res) + diag($output); + +$res = ok( + it::match('Mozilla', it_url::get(U('http://localhost:8000/get_server_value', 'key' => 'HTTP_USER_AGENT'))), + 'it_url::get() sets User-Agent containing Mozilla', +); +$output = server_output(); +if (!$res) + diag($output); + $pages = it_url::get_multi('urls' => array('a' => 'http://www.gna.ch/', 'b' => 'http://search.ch/')); ok(strpos($pages['a'], '</html>'), 'it_url::get_multi got first url'); # UTF8SAFE ok(strpos($pages['b'], '</html>'), 'it_url::get_multi got second url'); # UTF8SAFE diff --git a/tests/it_url.testserver.php b/tests/it_url.testserver.php index 22dc14b..fe90fcb 100644 --- a/tests/it_url.testserver.php +++ b/tests/it_url.testserver.php @@ -51,6 +51,10 @@ switch ($_SERVER['PHP_SELF']) } break; + case "/get_server_value": + echo $_SERVER[$_REQUEST['key']]; + break; + default: fwrite($stderr, "Unknown path '$_SERVER[PHP_SELF]' not handled!\n"); } |