diff options
-rwxr-xr-x | tests/it_url.t | 16 | ||||
-rw-r--r-- | tests/it_url.testserver.php | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/tests/it_url.t b/tests/it_url.t index 83f818f..379a4cb 100755 --- a/tests/it_url.t +++ b/tests/it_url.t @@ -235,12 +235,24 @@ if (!ok( $output = handle_server( ok( !it_url::get(array('url' => 'http://localhost:8000/does_not_exist', 'retries' => 4)), - 'it_url::get() retries on empty response' + 'it_url::get() on 404' + ) +); +if (!ok( + count(preg_grep('/^Got Request:/', $output)) == 1, + 'it_url::get() does not retry on 404' +)) + diag($output); + +$output = handle_server( + ok( + !it_url::get(array('url' => 'http://localhost:8000/repeat?num=0', 'retries' => 4)), + 'it_url::get() on empty page' ) ); if (!ok( count(preg_grep('/^Got Request:/', $output)) == 5, - 'it_url::get() respects set retry count' + 'it_url::get() does retry on empty page' )) diag($output); diff --git a/tests/it_url.testserver.php b/tests/it_url.testserver.php index 8763d6f..0fb3252 100644 --- a/tests/it_url.testserver.php +++ b/tests/it_url.testserver.php @@ -61,5 +61,6 @@ switch ($_SERVER['PHP_SELF']) break; default: + http_response_code(404); fwrite($stderr, "Unknown path '$_SERVER[PHP_SELF]' not handled!\n"); } |