From 2946cad416b247327c033f61fda8270c6771248b Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 18 Apr 2024 18:17:42 +0200 Subject: introduce empty_on_fail, get keepfailed to work --- test/it_url.t | 26 +++++++++++++++++++++++--- test/it_url.testserver.php | 5 +++++ 2 files changed, 28 insertions(+), 3 deletions(-) (limited to 'test') 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 "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]), diff --git a/test/it_url.testserver.php b/test/it_url.testserver.php index 978e4af..ca5300c 100644 --- a/test/it_url.testserver.php +++ b/test/it_url.testserver.php @@ -80,6 +80,11 @@ switch ($_SERVER['PHP_SELF']) echo $iserror ? "failure" : "success"; break; + case "/not_found_with_body": + http_response_code(404); + echo 'Testserver 404 output'; + break; + default: http_response_code(404); fwrite($stderr, "Unknown path '$_SERVER[PHP_SELF]' not handled!\n"); -- cgit v1.2.3