summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2017-08-17 14:54:37 +0200
committerNathan Gass2017-08-17 14:54:37 +0200
commit2f68913fecf3a1d7d9b3eedfaeca35665c6372f5 (patch)
treefdae8048bc56e015986ea46b85d2d52b8618b9d0
parentc538a7a9159454aa0c2114ace81f5f15f154dece (diff)
downloaditools-2f68913fecf3a1d7d9b3eedfaeca35665c6372f5.tar.gz
itools-2f68913fecf3a1d7d9b3eedfaeca35665c6372f5.tar.bz2
itools-2f68913fecf3a1d7d9b3eedfaeca35665c6372f5.zip
testserver returns 404 on unknown path, better reflect intended retry behaviour in tests and test descriptions
-rwxr-xr-xtests/it_url.t16
-rw-r--r--tests/it_url.testserver.php1
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");
}