From 2f68913fecf3a1d7d9b3eedfaeca35665c6372f5 Mon Sep 17 00:00:00 2001 From: Nathan Gass Date: Thu, 17 Aug 2017 14:54:37 +0200 Subject: testserver returns 404 on unknown path, better reflect intended retry behaviour in tests and test descriptions --- tests/it_url.t | 16 ++++++++++++++-- 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"); } -- cgit v1.2.3