From 96d059e9210a6677427392d615bc42ab38b3b432 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 2 Nov 2005 13:21:22 +0000 Subject: [PATCH] - extend & fixup test suite --- tests/HttpMessage_001.phpt | 2 +- tests/HttpMessage_002.phpt | 32 +++++++++++++++++ tests/HttpRequestPool_001.phpt | 2 +- tests/HttpRequest_001.phpt | 2 +- tests/HttpRequest_002.phpt | 2 +- tests/HttpRequest_003.phpt | 2 +- tests/HttpResponse_001.phpt | 6 ++-- tests/HttpResponse_002.phpt | 2 +- tests/HttpResponse_003.phpt | 4 +-- tests/HttpResponse_004.phpt | 6 ++-- tests/allowed_methods_001.phpt | 1 + tests/allowed_methods_001_logging.phpt | 1 + tests/allowed_methods_002.phpt | 21 +++++++++++ tests/allowed_methods_002_logging.phpt | 21 +++++++++++ tests/cloning_001.phpt | 2 +- tests/etag_mode_001.phpt | 1 + tests/etag_mode_002.phpt | 1 + tests/etag_mode_003.phpt | 1 + tests/etag_mode_004.phpt | 1 + tests/etag_mode_011.phpt | 1 + tests/etag_mode_012.phpt | 1 + tests/etag_mode_013.phpt | 1 + tests/etag_mode_014.phpt | 1 + tests/etag_mode_031.phpt | 23 ++++++++++++ tests/etag_mode_032.phpt | 23 ++++++++++++ tests/etag_mode_033.phpt | 23 ++++++++++++ tests/etag_mode_034.phpt | 25 +++++++++++++ tests/etag_mode_041.phpt | 21 +++++++++++ tests/etag_mode_042.phpt | 22 ++++++++++++ tests/etag_mode_043.phpt | 21 +++++++++++ tests/etag_mode_044.phpt | 23 ++++++++++++ tests/etag_mode_crc.phpt | 2 +- tests/exceptions.phpt | 2 +- tests/redirect_001.phpt | 3 +- tests/redirect_001_logging.phpt | 1 + tests/redirect_002.phpt | 3 +- tests/redirect_002_logging.phpt | 1 + tests/redirect_003.phpt | 3 +- tests/redirect_003_logging.phpt | 1 + tests/redirect_011.phpt | 24 +++++++++++++ tests/redirect_011_logging.phpt | 21 +++++++++++ tests/redirect_012.phpt | 27 ++++++++++++++ tests/redirect_012_logging.phpt | 21 +++++++++++ tests/redirect_013.phpt | 24 +++++++++++++ tests/redirect_013_logging.phpt | 21 +++++++++++ tests/send_data_007.phpt | 3 +- tests/send_data_007_logging.phpt | 1 + tests/send_data_008.phpt | 5 +-- tests/send_data_009.phpt | 3 +- tests/send_data_010.phpt | 20 +++++++++++ tests/send_data_011.phpt | 22 ++++++++++++ tests/send_file_001.phpt | 3 +- tests/send_file_002.phpt | 5 +-- tests/send_file_003.phpt | 3 +- tests/send_file_004.phpt | 3 +- tests/send_file_006.phpt | 3 +- tests/send_file_007.phpt | 3 +- tests/send_file_008.phpt | 28 +++++++++++++++ tests/send_file_009.phpt | 23 ++++++++++++ tests/send_file_010.phpt | 23 ++++++++++++ tests/send_file_011.phpt | 23 ++++++++++++ tests/send_file_012.phpt | 30 ++++++++++++++++ tests/send_file_013.phpt | 18 ++++++++++ tests/skip.inc | 3 +- tests/urls.txt | 49 ++++++++++++++++++++++++++ 65 files changed, 688 insertions(+), 32 deletions(-) create mode 100644 tests/HttpMessage_002.phpt create mode 100644 tests/allowed_methods_002.phpt create mode 100644 tests/allowed_methods_002_logging.phpt create mode 100644 tests/etag_mode_031.phpt create mode 100644 tests/etag_mode_032.phpt create mode 100644 tests/etag_mode_033.phpt create mode 100644 tests/etag_mode_034.phpt create mode 100644 tests/etag_mode_041.phpt create mode 100644 tests/etag_mode_042.phpt create mode 100644 tests/etag_mode_043.phpt create mode 100644 tests/etag_mode_044.phpt create mode 100644 tests/redirect_011.phpt create mode 100644 tests/redirect_011_logging.phpt create mode 100644 tests/redirect_012.phpt create mode 100644 tests/redirect_012_logging.phpt create mode 100644 tests/redirect_013.phpt create mode 100644 tests/redirect_013_logging.phpt create mode 100644 tests/send_data_010.phpt create mode 100644 tests/send_data_011.phpt create mode 100644 tests/send_file_008.phpt create mode 100644 tests/send_file_009.phpt create mode 100644 tests/send_file_010.phpt create mode 100644 tests/send_file_011.phpt create mode 100644 tests/send_file_012.phpt create mode 100644 tests/send_file_013.phpt create mode 100644 tests/urls.txt diff --git a/tests/HttpMessage_001.phpt b/tests/HttpMessage_001.phpt index 00e0e4b..eda359c 100644 --- a/tests/HttpMessage_001.phpt +++ b/tests/HttpMessage_001.phpt @@ -3,7 +3,7 @@ HttpMessage --SKIPIF-- --FILE-- +--FILE-- +headers); + $this->headers['Foo'] = 'Bar'; + } +} + +error_reporting(E_ALL|E_STRICT); + +echo "-TEST\n"; +$m = new Message; +$m->test(); +echo "Done\n"; +?> +--EXPECTF-- +%sTEST +Array +( +) +%sFatal error%sCannot access HttpMessage properties by reference or array key/index in%s diff --git a/tests/HttpRequestPool_001.phpt b/tests/HttpRequestPool_001.phpt index 9f20fe4..9adf35e 100644 --- a/tests/HttpRequestPool_001.phpt +++ b/tests/HttpRequestPool_001.phpt @@ -3,7 +3,7 @@ HttpRequestPool --SKIPIF-- --FILE-- diff --git a/tests/HttpRequest_002.phpt b/tests/HttpRequest_002.phpt index 76e12a3..ff8ab00 100644 --- a/tests/HttpRequest_002.phpt +++ b/tests/HttpRequest_002.phpt @@ -3,7 +3,7 @@ HttpRequest GET/POST --SKIPIF-- diff --git a/tests/HttpResponse_001.phpt b/tests/HttpResponse_001.phpt index 78b03e4..56b1913 100644 --- a/tests/HttpResponse_001.phpt +++ b/tests/HttpResponse_001.phpt @@ -3,7 +3,7 @@ HttpResponse - send data with caching headers --SKIPIF-- --FILE-- @@ -16,10 +16,10 @@ HttpResponse::send(); --EXPECTF-- X-Powered-By: PHP/%s ETag: "3858f62230ac3c915f300c664312c63f" -Cache-Control: public, must-revalidate, max_age=3600 +Cache-Control: public, must-revalidate, max-age=3600 Last-Modified: %s, %d %s 20%d %d:%d:%d GMT Content-Type: %s Accept-Ranges: bytes Content-Length: 6 -foobar \ No newline at end of file +foobar diff --git a/tests/HttpResponse_002.phpt b/tests/HttpResponse_002.phpt index 1c69a7f..72c22bc 100644 --- a/tests/HttpResponse_002.phpt +++ b/tests/HttpResponse_002.phpt @@ -3,7 +3,7 @@ HttpResponse - send gzipped file --SKIPIF-- diff --git a/tests/HttpResponse_003.phpt b/tests/HttpResponse_003.phpt index 4b5941c..960c0c5 100644 --- a/tests/HttpResponse_003.phpt +++ b/tests/HttpResponse_003.phpt @@ -3,7 +3,7 @@ HttpResponse - send gzipped file with caching headers --SKIPIF-- @@ -20,7 +20,7 @@ HttpResponse::send(); --EXPECTF-- X-Powered-By: PHP/%s ETag: "%s" -Cache-Control: public, must-revalidate, max_age=3600 +Cache-Control: public, must-revalidate, max-age=3600 Last-Modified: %s, %d %s 20%d %d:%d:%d GMT Content-Type: %s Accept-Ranges: bytes diff --git a/tests/HttpResponse_004.phpt b/tests/HttpResponse_004.phpt index a0f569d..f5e768d 100644 --- a/tests/HttpResponse_004.phpt +++ b/tests/HttpResponse_004.phpt @@ -3,8 +3,8 @@ HttpResponse - send cached gzipped data --SKIPIF-- --ENV-- @@ -20,7 +20,7 @@ HttpResponse::send(); ?> --EXPECTF-- Status: 304 -Content-type: %s X-Powered-By: PHP/%s -Cache-Control: public, must-revalidate, max_age=3600 +Cache-Control: public, must-revalidate, max-age=3600 ETag: "80b285463881575891e86ba7bfecb4d0" +Content-type: %s diff --git a/tests/allowed_methods_001.phpt b/tests/allowed_methods_001.phpt index f0b7d9c..b7e3ba5 100644 --- a/tests/allowed_methods_001.phpt +++ b/tests/allowed_methods_001.phpt @@ -4,6 +4,7 @@ allowed methods --FILE-- --ENV-- HTTP_HOST=example.com diff --git a/tests/allowed_methods_002.phpt b/tests/allowed_methods_002.phpt new file mode 100644 index 0000000..2185d8b --- /dev/null +++ b/tests/allowed_methods_002.phpt @@ -0,0 +1,21 @@ +--TEST-- +allowed methods +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Status: 405 +X-Powered-By: PHP/%s +Allow: POST +Content-type: %s + diff --git a/tests/allowed_methods_002_logging.phpt b/tests/allowed_methods_002_logging.phpt new file mode 100644 index 0000000..73b458b --- /dev/null +++ b/tests/allowed_methods_002_logging.phpt @@ -0,0 +1,21 @@ +--TEST-- +logging allowed methods +--SKIPIF-- + +--ENV-- +HTTP_HOST=example.com +--FILE-- + +--EXPECTF-- +%sTEST +%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [405-ALLOWED] Allow: POST <%s> +Done diff --git a/tests/cloning_001.phpt b/tests/cloning_001.phpt index 73b7734..7b40fdc 100644 --- a/tests/cloning_001.phpt +++ b/tests/cloning_001.phpt @@ -3,7 +3,7 @@ cloning --SKIPIF-- --FILE-- diff --git a/tests/etag_mode_001.phpt b/tests/etag_mode_001.phpt index d8cf594..8c396fb 100644 --- a/tests/etag_mode_001.phpt +++ b/tests/etag_mode_001.phpt @@ -4,6 +4,7 @@ crc32 etag --FILE-- --FILE-- --FILE-- diff --git a/tests/etag_mode_011.phpt b/tests/etag_mode_011.phpt index 06b35e1..d4a2712 100644 --- a/tests/etag_mode_011.phpt +++ b/tests/etag_mode_011.phpt @@ -4,6 +4,7 @@ ob crc32 etag --FILE-- --FILE-- diff --git a/tests/etag_mode_013.phpt b/tests/etag_mode_013.phpt index 4100173..d81ba60 100644 --- a/tests/etag_mode_013.phpt +++ b/tests/etag_mode_013.phpt @@ -4,6 +4,7 @@ ob md5 etag --FILE-- diff --git a/tests/etag_mode_031.phpt b/tests/etag_mode_031.phpt new file mode 100644 index 0000000..1ac27e2 --- /dev/null +++ b/tests/etag_mode_031.phpt @@ -0,0 +1,23 @@ +--TEST-- +crc32 etag +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Cache-Control: private, must-revalidate, max-age=0 +Accept-Ranges: bytes +ETag: "4e818847" +Content-Length: 4 +Content-type: %s + +abc diff --git a/tests/etag_mode_032.phpt b/tests/etag_mode_032.phpt new file mode 100644 index 0000000..3806381 --- /dev/null +++ b/tests/etag_mode_032.phpt @@ -0,0 +1,23 @@ +--TEST-- +sha1 etag +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Cache-Control: private, must-revalidate, max-age=0 +Accept-Ranges: bytes +ETag: "03cfd743661f07975fa2f1220c5194cbaff48451" +Content-Length: 4 +Content-type: %s + +abc diff --git a/tests/etag_mode_033.phpt b/tests/etag_mode_033.phpt new file mode 100644 index 0000000..f87f3fa --- /dev/null +++ b/tests/etag_mode_033.phpt @@ -0,0 +1,23 @@ +--TEST-- +md5 etag +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Cache-Control: private, must-revalidate, max-age=0 +Accept-Ranges: bytes +ETag: "0bee89b07a248e27c83fc3d5951213c1" +Content-Length: 4 +Content-type: %s + +abc diff --git a/tests/etag_mode_034.phpt b/tests/etag_mode_034.phpt new file mode 100644 index 0000000..b8bb04d --- /dev/null +++ b/tests/etag_mode_034.phpt @@ -0,0 +1,25 @@ +--TEST-- +mhash etag +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Content-type: %s +X-Powered-By: PHP/%s +Cache-Control: private, must-revalidate, max-age=0 +Accept-Ranges: bytes +ETag: "53efa9e423f86dabd449b3e23dd0350def661b9e7055b23ceb2230c8b61bc0766514957ea9d349a88ef794715a1a17a409b549edfd6f43d696e63407fff3541c" +Content-Length: 4 + +abc diff --git a/tests/etag_mode_041.phpt b/tests/etag_mode_041.phpt new file mode 100644 index 0000000..3e15bc1 --- /dev/null +++ b/tests/etag_mode_041.phpt @@ -0,0 +1,21 @@ +--TEST-- +ob crc32 etag +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Cache-Control: private, must-revalidate, max-age=0 +ETag: "4e818847" +Content-type: %s + +abc diff --git a/tests/etag_mode_042.phpt b/tests/etag_mode_042.phpt new file mode 100644 index 0000000..68aab73 --- /dev/null +++ b/tests/etag_mode_042.phpt @@ -0,0 +1,22 @@ +--TEST-- +ob sha1 etag +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Cache-Control: private, must-revalidate, max-age=0 +ETag: "03cfd743661f07975fa2f1220c5194cbaff48451" +Content-type: %s + +abc diff --git a/tests/etag_mode_043.phpt b/tests/etag_mode_043.phpt new file mode 100644 index 0000000..251381b --- /dev/null +++ b/tests/etag_mode_043.phpt @@ -0,0 +1,21 @@ +--TEST-- +ob md5 etag +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Cache-Control: private, must-revalidate, max-age=0 +ETag: "0bee89b07a248e27c83fc3d5951213c1" +Content-type: %s + +abc diff --git a/tests/etag_mode_044.phpt b/tests/etag_mode_044.phpt new file mode 100644 index 0000000..c7c3e10 --- /dev/null +++ b/tests/etag_mode_044.phpt @@ -0,0 +1,23 @@ +--TEST-- +ob mhash etag +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Cache-Control: private, must-revalidate, max-age=0 +ETag: "53efa9e423f86dabd449b3e23dd0350def661b9e7055b23ceb2230c8b61bc0766514957ea9d349a88ef794715a1a17a409b549edfd6f43d696e63407fff3541c" +Content-type: %s + +abc diff --git a/tests/etag_mode_crc.phpt b/tests/etag_mode_crc.phpt index ffe5a06..62fbb3f 100644 --- a/tests/etag_mode_crc.phpt +++ b/tests/etag_mode_crc.phpt @@ -3,7 +3,7 @@ sane crc etags --SKIPIF-- --FILE-- --ENV-- HTTP_HOST=localhost @@ -15,7 +16,7 @@ http_redirect('redirect', array('a' => 1, 'b' => 2)); ?> --EXPECTF-- Status: 302 -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Location: http://localhost/redirect?a=1&b=2 diff --git a/tests/redirect_001_logging.phpt b/tests/redirect_001_logging.phpt index b2d1361..273f8b8 100644 --- a/tests/redirect_001_logging.phpt +++ b/tests/redirect_001_logging.phpt @@ -4,6 +4,7 @@ logging redirects --ENV-- HTTP_HOST=example.com diff --git a/tests/redirect_002.phpt b/tests/redirect_002.phpt index e577810..29985f3 100644 --- a/tests/redirect_002.phpt +++ b/tests/redirect_002.phpt @@ -4,6 +4,7 @@ http_redirect() with session --ENV-- @@ -17,7 +18,7 @@ http_redirect('redirect', array('a' => 1), true); ?> --EXPECTF-- Status: 302 -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Set-Cookie: PHPSESSID=%s; path=/ Expires: %s diff --git a/tests/redirect_002_logging.phpt b/tests/redirect_002_logging.phpt index b2d1361..273f8b8 100644 --- a/tests/redirect_002_logging.phpt +++ b/tests/redirect_002_logging.phpt @@ -4,6 +4,7 @@ logging redirects --ENV-- HTTP_HOST=example.com diff --git a/tests/redirect_003.phpt b/tests/redirect_003.phpt index 0de0195..6396e09 100644 --- a/tests/redirect_003.phpt +++ b/tests/redirect_003.phpt @@ -4,6 +4,7 @@ http_redirect() permanent --ENV-- HTTP_HOST=localhost @@ -15,7 +16,7 @@ http_redirect('redirect', null, false, HTTP_REDIRECT_PERM); ?> --EXPECTF-- Status: 301 -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Location: http://localhost/redirect diff --git a/tests/redirect_003_logging.phpt b/tests/redirect_003_logging.phpt index 7da6405..eb282d2 100644 --- a/tests/redirect_003_logging.phpt +++ b/tests/redirect_003_logging.phpt @@ -4,6 +4,7 @@ logging redirects --ENV-- HTTP_HOST=example.com diff --git a/tests/redirect_011.phpt b/tests/redirect_011.phpt new file mode 100644 index 0000000..fc3f3d2 --- /dev/null +++ b/tests/redirect_011.phpt @@ -0,0 +1,24 @@ +--TEST-- +http_redirect() with params +--SKIPIF-- + +--ENV-- +HTTP_HOST=localhost +--FILE-- + 1, 'b' => 2)); +?> +--EXPECTF-- +Status: 302 +X-Powered-By: PHP/%s +Location: http://localhost/redirect?a=1&b=2 +Content-type: %s + +Redirecting to http://localhost/redirect?a=1&b=2. + diff --git a/tests/redirect_011_logging.phpt b/tests/redirect_011_logging.phpt new file mode 100644 index 0000000..237c043 --- /dev/null +++ b/tests/redirect_011_logging.phpt @@ -0,0 +1,21 @@ +--TEST-- +logging redirects +--SKIPIF-- + +--ENV-- +HTTP_HOST=example.com +--FILE-- + +--EXPECTF-- +%sTEST +%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [302-REDIRECT] Location: http%s <%s> +Done diff --git a/tests/redirect_012.phpt b/tests/redirect_012.phpt new file mode 100644 index 0000000..1d48ae5 --- /dev/null +++ b/tests/redirect_012.phpt @@ -0,0 +1,27 @@ +--TEST-- +http_redirect() with session +--SKIPIF-- + +--ENV-- +HTTP_HOST=localhost +--FILE-- + 1), true); +?> +--EXPECTF-- +Status: 302 +X-Powered-By: PHP/%s +Set-Cookie: PHPSESSID=%s; path=/ +Expires: %s +Cache-Control: %s +Pragma: %s +Location: http://localhost/redirect?a=1&PHPSESSID=%s +Content-type: %s diff --git a/tests/redirect_012_logging.phpt b/tests/redirect_012_logging.phpt new file mode 100644 index 0000000..237c043 --- /dev/null +++ b/tests/redirect_012_logging.phpt @@ -0,0 +1,21 @@ +--TEST-- +logging redirects +--SKIPIF-- + +--ENV-- +HTTP_HOST=example.com +--FILE-- + +--EXPECTF-- +%sTEST +%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [302-REDIRECT] Location: http%s <%s> +Done diff --git a/tests/redirect_013.phpt b/tests/redirect_013.phpt new file mode 100644 index 0000000..8ef8a6b --- /dev/null +++ b/tests/redirect_013.phpt @@ -0,0 +1,24 @@ +--TEST-- +http_redirect() permanent +--SKIPIF-- + +--ENV-- +HTTP_HOST=localhost +--FILE-- + +--EXPECTF-- +Status: 301 +X-Powered-By: PHP/%s +Location: http://localhost/redirect +Content-type: %s + +Redirecting to http://localhost/redirect. + diff --git a/tests/redirect_013_logging.phpt b/tests/redirect_013_logging.phpt new file mode 100644 index 0000000..0a98118 --- /dev/null +++ b/tests/redirect_013_logging.phpt @@ -0,0 +1,21 @@ +--TEST-- +logging redirects +--SKIPIF-- + +--ENV-- +HTTP_HOST=example.com +--FILE-- + +--EXPECTF-- +%sTEST +%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [301-REDIRECT] Location: http%s <%s> +Done diff --git a/tests/send_data_007.phpt b/tests/send_data_007.phpt index f6d6058..478d58d 100644 --- a/tests/send_data_007.phpt +++ b/tests/send_data_007.phpt @@ -4,6 +4,7 @@ http_send_data() etag caching --ENV-- HTTP_IF_NONE_MATCH="0bee89b07a248e27c83fc3d5951213c1" @@ -16,7 +17,7 @@ http_send_data("abc\n"); ?> --EXPECTF-- Status: 304 -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Cache-Control: private, must-revalidate, max-age=0 %s diff --git a/tests/send_data_007_logging.phpt b/tests/send_data_007_logging.phpt index 1fbab30..ed7719b 100644 --- a/tests/send_data_007_logging.phpt +++ b/tests/send_data_007_logging.phpt @@ -4,6 +4,7 @@ logging caching --ENV-- HTTP_HOST=example.com diff --git a/tests/send_data_008.phpt b/tests/send_data_008.phpt index cb0fc6d..f5d4e85 100644 --- a/tests/send_data_008.phpt +++ b/tests/send_data_008.phpt @@ -4,6 +4,7 @@ http_send_data() HTTP_SENDBUF_SIZE long string --FILE-- --EXPECTF-- -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Accept-Ranges: bytes Content-Length: 20 -00000000000000000000 \ No newline at end of file +00000000000000000000 diff --git a/tests/send_data_009.phpt b/tests/send_data_009.phpt index 8fb1868..1d8358d 100644 --- a/tests/send_data_009.phpt +++ b/tests/send_data_009.phpt @@ -4,6 +4,7 @@ http_send_data() last modified caching --FILE-- --EXPECTF-- -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Cache-Control: private, must-revalidate, max-age=0 Last-Modified: %s, %d %s %d %d:%d:%d GMT diff --git a/tests/send_data_010.phpt b/tests/send_data_010.phpt new file mode 100644 index 0000000..9553c8d --- /dev/null +++ b/tests/send_data_010.phpt @@ -0,0 +1,20 @@ +--TEST-- +http_send_data() HTTP_SENDBUF_SIZE long string +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Accept-Ranges: bytes +Content-Length: 20 +Content-type: %s + +00000000000000000000 diff --git a/tests/send_data_011.phpt b/tests/send_data_011.phpt new file mode 100644 index 0000000..9506078 --- /dev/null +++ b/tests/send_data_011.phpt @@ -0,0 +1,22 @@ +--TEST-- +http_send_data() last modified caching +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Cache-Control: private, must-revalidate, max-age=0 +Last-Modified: %s, %d %s %d %d:%d:%d GMT +Accept-Ranges: bytes +Content-Length: 4 +Content-type: %s + +abc diff --git a/tests/send_file_001.phpt b/tests/send_file_001.phpt index c4b2af5..c105075 100644 --- a/tests/send_file_001.phpt +++ b/tests/send_file_001.phpt @@ -4,13 +4,14 @@ http_send_file() --FILE-- --EXPECTF-- -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Accept-Ranges: bytes Content-Length: 1010 diff --git a/tests/send_file_002.phpt b/tests/send_file_002.phpt index da87c5f..1bcd07d 100644 --- a/tests/send_file_002.phpt +++ b/tests/send_file_002.phpt @@ -4,6 +4,7 @@ http_send_file() NUM-NUM range --ENV-- HTTP_RANGE=bytes=5-9 @@ -13,10 +14,10 @@ http_send_file('data.txt'); ?> --EXPECTF-- Status: 206 -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Accept-Ranges: bytes Content-Range: bytes 5-9/1010 Content-Length: 5 -56789 \ No newline at end of file +56789 diff --git a/tests/send_file_003.phpt b/tests/send_file_003.phpt index 9e3986b..8a17f58 100644 --- a/tests/send_file_003.phpt +++ b/tests/send_file_003.phpt @@ -4,6 +4,7 @@ http_send_file() NIL-NUM range --ENV-- HTTP_RANGE=bytes=-9 @@ -13,7 +14,7 @@ http_send_file('data.txt'); ?> --EXPECTF-- Status: 206 -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Accept-Ranges: bytes Content-Range: bytes 1001-1009/1010 diff --git a/tests/send_file_004.phpt b/tests/send_file_004.phpt index 54c0212..5dcee32 100644 --- a/tests/send_file_004.phpt +++ b/tests/send_file_004.phpt @@ -4,6 +4,7 @@ http_send_file() NUM-NIL range --ENV-- HTTP_RANGE=bytes=1000- @@ -13,7 +14,7 @@ http_send_file('data.txt'); ?> --EXPECTF-- Status: 206 -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Accept-Ranges: bytes Content-Range: bytes 1000-1009/1010 diff --git a/tests/send_file_006.phpt b/tests/send_file_006.phpt index 10f170a..fdca630 100644 --- a/tests/send_file_006.phpt +++ b/tests/send_file_006.phpt @@ -4,6 +4,7 @@ http_send_file() syntactically invalid range --ENV-- HTTP_RANGE=bytes=xxx @@ -12,7 +13,7 @@ HTTP_RANGE=bytes=xxx http_send_file('data.txt'); ?> --EXPECTF-- -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s Accept-Ranges: bytes Content-Length: 1010 diff --git a/tests/send_file_007.phpt b/tests/send_file_007.phpt index a337546..966129c 100644 --- a/tests/send_file_007.phpt +++ b/tests/send_file_007.phpt @@ -4,6 +4,7 @@ http_send_file() oversized range --ENV-- HTTP_RANGE=bytes=-1111 @@ -13,5 +14,5 @@ http_send_file('data.txt'); ?> --EXPECTF-- Status: 416 -Content-type: text/html +Content-type: %s X-Powered-By: PHP/%s diff --git a/tests/send_file_008.phpt b/tests/send_file_008.phpt new file mode 100644 index 0000000..556cea7 --- /dev/null +++ b/tests/send_file_008.phpt @@ -0,0 +1,28 @@ +--TEST-- +http_send_file() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Accept-Ranges: bytes +Content-Length: 1010 +Content-type: %s + +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 diff --git a/tests/send_file_009.phpt b/tests/send_file_009.phpt new file mode 100644 index 0000000..bc157a9 --- /dev/null +++ b/tests/send_file_009.phpt @@ -0,0 +1,23 @@ +--TEST-- +http_send_file() NUM-NUM range +--SKIPIF-- + +--ENV-- +HTTP_RANGE=bytes=5-9 +--FILE-- + +--EXPECTF-- +Status: 206 +X-Powered-By: PHP/%s +Accept-Ranges: bytes +Content-Range: bytes 5-9/1010 +Content-Length: 5 +Content-type: %s + +56789 diff --git a/tests/send_file_010.phpt b/tests/send_file_010.phpt new file mode 100644 index 0000000..20b853a --- /dev/null +++ b/tests/send_file_010.phpt @@ -0,0 +1,23 @@ +--TEST-- +http_send_file() NIL-NUM range +--SKIPIF-- + +--ENV-- +HTTP_RANGE=bytes=-9 +--FILE-- + +--EXPECTF-- +Status: 206 +X-Powered-By: PHP/%s +Accept-Ranges: bytes +Content-Range: bytes 1001-1009/1010 +Content-Length: 9 +Content-type: %s + +23456789 diff --git a/tests/send_file_011.phpt b/tests/send_file_011.phpt new file mode 100644 index 0000000..5ac521f --- /dev/null +++ b/tests/send_file_011.phpt @@ -0,0 +1,23 @@ +--TEST-- +http_send_file() NUM-NIL range +--SKIPIF-- + +--ENV-- +HTTP_RANGE=bytes=1000- +--FILE-- + +--EXPECTF-- +Status: 206 +X-Powered-By: PHP/%s +Accept-Ranges: bytes +Content-Range: bytes 1000-1009/1010 +Content-Length: 10 +Content-type: %s + +123456789 diff --git a/tests/send_file_012.phpt b/tests/send_file_012.phpt new file mode 100644 index 0000000..0e4ce0e --- /dev/null +++ b/tests/send_file_012.phpt @@ -0,0 +1,30 @@ +--TEST-- +http_send_file() syntactically invalid range +--SKIPIF-- + +--ENV-- +HTTP_RANGE=bytes=xxx +--FILE-- + +--EXPECTF-- +X-Powered-By: PHP/%s +Accept-Ranges: bytes +Content-Length: 1010 +Content-type: %s + +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 diff --git a/tests/send_file_013.phpt b/tests/send_file_013.phpt new file mode 100644 index 0000000..e97a091 --- /dev/null +++ b/tests/send_file_013.phpt @@ -0,0 +1,18 @@ +--TEST-- +http_send_file() oversized range +--SKIPIF-- + +--ENV-- +HTTP_RANGE=bytes=-1111 +--FILE-- + +--EXPECTF-- +Status: 416 +X-Powered-By: PHP/%s +Content-type: %s diff --git a/tests/skip.inc b/tests/skip.inc index f273c91..268edf1 100644 --- a/tests/skip.inc +++ b/tests/skip.inc @@ -3,7 +3,8 @@ defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); function skipif($if, $skip) { if ($if) { fprintf(STDOUT, "skip $skip"); exit(); }} function checkcgi() { skipif(!strncasecmp('CLI', PHP_SAPI, 3), 'need CGI SAPI'); } function checkext($ext) { skipif(!extension_loaded($ext), "need ext/$ext"); } -function checkver($ver) { skipif(round($ver,1) > round((double) PHP_VERSION,1), "need PHP v$ver"); } +function checkmin($ver) { skipif(round($ver,1) > round((double) PHP_VERSION,1), sprintf("need PHP >= v%0.1f",$ver)); } +function checkmax($ver) { skipif(round($ver,1) < round((double) PHP_VERSION,1), sprintf("need PHP <= v%0.1f",$ver)); } function checkurl($url) { skipif(!@fsockopen($url, 80), "$url not responsive"); } function checkcls($cls) { skipif(!class_exists($cls), "need class $cls"); } checkext('http'); diff --git a/tests/urls.txt b/tests/urls.txt new file mode 100644 index 0000000..183c62e --- /dev/null +++ b/tests/urls.txt @@ -0,0 +1,49 @@ +http://www.microsoft.com +http://www.opensource.org +http://www.google.com +http://www.yahoo.com +http://www.ibm.com +http://www.mysql.com +http://www.oracle.com +http://www.ripe.net +http://www.iana.org +http://www.amazon.com +http://www.netcraft.com +http://www.heise.de +http://www.chip.de +http://www.ca.com +http://www.cnet.com +http://www.news.com +http://www.cnn.com +http://www.wikipedia.org +http://www.dell.com +http://www.hp.com +http://www.cert.org +http://www.mit.edu +http://www.nist.gov +http://www.ebay.com +http://www.playstation.com +http://www.uefa.com +http://www.ieee.org +http://www.apple.com +http://www.sony.com +http://www.symantec.com +http://www.zdnet.com +http://www.fujitsu.com +http://www.supermicro.com +http://www.hotmail.com +http://www.ecma.com +http://www.bbc.co.uk +http://news.google.com +http://www.foxnews.com +http://www.msn.com +http://www.wired.com +http://www.sky.com +http://www.usatoday.com +http://www.cbs.com +http://www.nbc.com +http://slashdot.org +http://www.bloglines.com +http://www.techweb.com +http://www.newslink.org +http://www.un.org \ No newline at end of file -- 2.30.2