From abed613e325f2307a01030746fc512405c7c024c Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Sun, 13 Feb 2005 10:41:15 +0000 Subject: [PATCH] * adding tests --- tests/001_date.phpt | 18 +++++++++++++++++ tests/002_date.phpt | 22 ++++++++++++++++++++ tests/010_abs_uri.phpt | 18 +++++++++++++++++ tests/011_abs_uri.phpt | 20 ++++++++++++++++++ tests/020_redirect.phpt | 19 ++++++++++++++++++ tests/021_redirect.phpt | 21 +++++++++++++++++++ tests/022_redirect.phpt | 19 ++++++++++++++++++ tests/030_send_data.phpt | 14 +++++++++++++ tests/040_chunked_decode.phpt | 26 ++++++++++++++++++++++++ tests/050_split_response.phpt | 25 +++++++++++++++++++++++ tests/051_parse_headers.phpt | 38 +++++++++++++++++++++++++++++++++++ 11 files changed, 240 insertions(+) create mode 100644 tests/001_date.phpt create mode 100644 tests/002_date.phpt create mode 100644 tests/010_abs_uri.phpt create mode 100644 tests/011_abs_uri.phpt create mode 100644 tests/020_redirect.phpt create mode 100644 tests/021_redirect.phpt create mode 100644 tests/022_redirect.phpt create mode 100644 tests/030_send_data.phpt create mode 100644 tests/040_chunked_decode.phpt create mode 100644 tests/050_split_response.phpt create mode 100644 tests/051_parse_headers.phpt diff --git a/tests/001_date.phpt b/tests/001_date.phpt new file mode 100644 index 0000000..7bd8b64 --- /dev/null +++ b/tests/001_date.phpt @@ -0,0 +1,18 @@ +--TEST-- +http_date() with timestamp +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Content-type: text/html +X-Powered-By: PHP/%s + +Thu, 01 Jan 1970 00:00:01 GMT +Fri, 13 Feb 2009 23:31:30 GMT diff --git a/tests/002_date.phpt b/tests/002_date.phpt new file mode 100644 index 0000000..f518188 --- /dev/null +++ b/tests/002_date.phpt @@ -0,0 +1,22 @@ +--TEST-- +http_date() without timestamp +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Content-type: text/html +X-Powered-By: PHP/%s + +bool(true) +%d +%s, %d %s %d %d:%d:%d GMT +%s, %d %s %d %d:%d:%d GMT diff --git a/tests/010_abs_uri.phpt b/tests/010_abs_uri.phpt new file mode 100644 index 0000000..67b1beb --- /dev/null +++ b/tests/010_abs_uri.phpt @@ -0,0 +1,18 @@ +--TEST-- +http_absolute_uri() with relative paths +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Content-type: text/html +X-Powered-By: PHP/%s + +http://localhost/page +http://localhost/with/some/path/ diff --git a/tests/011_abs_uri.phpt b/tests/011_abs_uri.phpt new file mode 100644 index 0000000..fa4db1b --- /dev/null +++ b/tests/011_abs_uri.phpt @@ -0,0 +1,20 @@ +--TEST-- +http_absolute_uri() with proto +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Content-type: text/html +X-Powered-By: PHP/%s + +https://localhost/sec +ftp://localhost/pub +http://localhost/ diff --git a/tests/020_redirect.phpt b/tests/020_redirect.phpt new file mode 100644 index 0000000..b849ced --- /dev/null +++ b/tests/020_redirect.phpt @@ -0,0 +1,19 @@ +--TEST-- +http_redirect() with params +--SKIPIF-- + +--FILE-- + 1, 'b' => 2)); +?> +--EXPECTF-- +Status: 302 +Content-type: text/html +X-Powered-By: PHP/%s +Location: http://localhost/redirect?a=1&b=2 + +Redirecting to http://localhost/redirect?a=1&b=2. + diff --git a/tests/021_redirect.phpt b/tests/021_redirect.phpt new file mode 100644 index 0000000..e8b2cca --- /dev/null +++ b/tests/021_redirect.phpt @@ -0,0 +1,21 @@ +--TEST-- +http_redirect() with session +--SKIPIF-- + +--FILE-- + 1), true); +?> +--EXPECTF-- +Status: 302 +Content-type: text/html +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 diff --git a/tests/022_redirect.phpt b/tests/022_redirect.phpt new file mode 100644 index 0000000..bd9a23d --- /dev/null +++ b/tests/022_redirect.phpt @@ -0,0 +1,19 @@ +--TEST-- +http_redirect() permanent +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Status: 301 +Content-type: text/html +X-Powered-By: PHP/%s +Location: http://localhost/redirect + +Redirecting to http://localhost/redirect. + diff --git a/tests/030_send_data.phpt b/tests/030_send_data.phpt new file mode 100644 index 0000000..301d45f --- /dev/null +++ b/tests/030_send_data.phpt @@ -0,0 +1,14 @@ +--TEST-- +http_send_data() +--SKIPIF-- + +--FILE-- + +--EXPECTREGEX-- +.+\s+.+\s+(abc|[123abc]{,100000}) \ No newline at end of file diff --git a/tests/040_chunked_decode.phpt b/tests/040_chunked_decode.phpt new file mode 100644 index 0000000..9f333f3 --- /dev/null +++ b/tests/040_chunked_decode.phpt @@ -0,0 +1,26 @@ +--TEST-- +http_chunked_decode() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Content-type: text/html +X-Powered-By: PHP/%s + +string(9) "aba +cabcd" diff --git a/tests/050_split_response.phpt b/tests/050_split_response.phpt new file mode 100644 index 0000000..3a562fd --- /dev/null +++ b/tests/050_split_response.phpt @@ -0,0 +1,25 @@ +--TEST-- +http_split_response() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Content-type: text/html +X-Powered-By: PHP/%s + +array ( + 0 => + array ( + 'Status' => '200 Ok', + 'Content-Type' => 'text/plain', + 'Content-Language' => 'de-AT', + 'Date' => 'Sat, 22 Jan 2005 18:10:02 GMT', + ), + 1 => 'Hallo Du!', +) \ No newline at end of file diff --git a/tests/051_parse_headers.phpt b/tests/051_parse_headers.phpt new file mode 100644 index 0000000..39afa55 --- /dev/null +++ b/tests/051_parse_headers.phpt @@ -0,0 +1,38 @@ +--TEST-- +http_parse_headers() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Content-type: text/html +X-Powered-By: PHP/%s + +Array +( + [Host] => localhost + [Nospace] => here + [Muchspace] => there + [Empty] => + [Empty2] => + [Folded] => one + two + three +) \ No newline at end of file -- 2.30.2