diff options
Diffstat (limited to 'test/it_url.t')
-rwxr-xr-x | test/it_url.t | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/test/it_url.t b/test/it_url.t index 02fe45c..01de74b 100755 --- a/test/it_url.t +++ b/test/it_url.t @@ -1,7 +1,7 @@ #!/www/server/bin/php -qC <?php -# Tests for url.class, currently only constructor's parser +require 'it_url_server.php'; it::getopt("Usage: it_url.t [OPTIONS]"); @@ -131,8 +131,6 @@ is( ); $_SERVER['PHP_SELF'] = $php_self; -require 'it_url_server.php'; - is(it_url::is_reachable('http://www.gna.ch/'), true, "is_reachable('http://www.gna.ch/')"); is(it_url::is_reachable('http://www.search.ch/not_found'), false, "is_reachable('http://www.search.ch/not_found')"); is(it_url::is_reachable('http://bogus.url'), false, "is_reachable('http://bogus.url')"); @@ -259,6 +257,28 @@ if (!ok( $output = handle_server( ok( + it_url::get(['url' => "http://$host/not_found_with_body", 'empty_on_fail' => false, 'it_error' => false]), + 'it_url::get() on 404 with body' + ) +); + +$output = handle_server( + ok( + !it_url::get(['url' => "http://$host/not_found_with_body", 'empty_on_fail' => true, 'it_error' => false]), + 'it_url::get() on 404 with body and empty_on_fail' + ) +); + +$output = handle_server( + is( + it::filter_keys(it_url::get(['url' => "http://$host/not_found_with_body", 'empty_on_fail' => true, 'it_error' => false, 'assoc' => true]), 'status,data'), + [], + 'it_url::get() on 404 with body, empty_on_fail and assoc' + ) +); + +$output = handle_server( + ok( !it_url::get(['url' => "http://$host/repeat?num=0", 'retries' => 4]), 'it_url::get() on empty page' ) |