cvs: pecl /http/tests 001_date.phpt 002_date.phpt 010_abs_uri.phpt 011_abs_uri.phpt 020_redirect.phpt 021_redirect.phpt 022_redirect.phpt
030_send_data.phpt 040_chunked_decode.phpt 050_split_response.phpt 051_parse_headers.phpt
| From: | Michael Wallner | Date: | Sun, 13 Feb 2005 10:41:15 +0000 |
| Subject: | cvs: pecl /http/tests 001_date.phpt 002_date.phpt 010_abs_uri.phpt 011_abs_uri.phpt 020_redirect.phpt 021_redirect.phpt 022_redirect.phpt 030_send_data.phpt 040_chunked_decode.phpt 050_split_response.phpt 051_parse_headers.phpt |
||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-2548@lists.php.net to get a copy of this message | ||
mike Sun Feb 13 05:41:15 2005 EDT
Added files:
/pecl/http/tests 001_date.phpt 002_date.phpt 010_abs_uri.phpt
011_abs_uri.phpt 020_redirect.phpt
021_redirect.phpt 022_redirect.phpt
030_send_data.phpt 040_chunked_decode.phpt
050_split_response.phpt 051_parse_headers.phpt
Log:
* adding tests
http://cvs.php.net/co.php/pecl/http/tests/001_date.phpt?r=1.1&p=1
Index: pecl/http/tests/001_date.phpt
+++ pecl/http/tests/001_date.phpt
--TEST--
http_date() with timestamp
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
echo http_date(1), "\n";
echo http_date(1234567890), "\n";
?>
--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
http://cvs.php.net/co.php/pecl/http/tests/002_date.phpt?r=1.1&p=1
Index: pecl/http/tests/002_date.phpt
+++ pecl/http/tests/002_date.phpt
--TEST--
http_date() without timestamp
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
$d1 = http_date();
$d2 = http_date();
var_dump($d1 === $d2);
echo strtotime($d1), "\n$d1\n$d2\n";
?>
--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
http://cvs.php.net/co.php/pecl/http/tests/010_abs_uri.phpt?r=1.1&p=1
Index: pecl/http/tests/010_abs_uri.phpt
+++ pecl/http/tests/010_abs_uri.phpt
--TEST--
http_absolute_uri() with relative paths
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
echo http_absolute_uri('page'), "\n";
echo http_absolute_uri('with/some/path/'), "\n";
?>
--EXPECTF--
Content-type: text/html
X-Powered-By: PHP/%s
http://localhost/page
http://localhost/with/some/path/
http://cvs.php.net/co.php/pecl/http/tests/011_abs_uri.phpt?r=1.1&p=1
Index: pecl/http/tests/011_abs_uri.phpt
+++ pecl/http/tests/011_abs_uri.phpt
--TEST--
http_absolute_uri() with proto
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
echo http_absolute_uri('sec', 'https'), "\n";
echo http_absolute_uri('/pub', 'ftp'), "\n";
echo http_absolute_uri('/', null), "\n";
?>
--EXPECTF--
Content-type: text/html
X-Powered-By: PHP/%s
https://localhost/sec
ftp://localhost/pub
http://localhost/
http://cvs.php.net/co.php/pecl/http/tests/020_redirect.phpt?r=1.1&p=1
Index: pecl/http/tests/020_redirect.phpt
+++ pecl/http/tests/020_redirect.phpt
--TEST--
http_redirect() with params
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
http_redirect('redirect', array('a' => 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 <a href="http://localhost/redirect?a=1&b=2">http://localhost/redirect?a=1&b=2</a>.
http://cvs.php.net/co.php/pecl/http/tests/021_redirect.phpt?r=1.1&p=1
Index: pecl/http/tests/021_redirect.phpt
+++ pecl/http/tests/021_redirect.phpt
--TEST--
http_redirect() with session
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
session_start();
http_redirect('redirect', array('a' => 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
http://cvs.php.net/co.php/pecl/http/tests/022_redirect.phpt?r=1.1&p=1
Index: pecl/http/tests/022_redirect.phpt
+++ pecl/http/tests/022_redirect.phpt
--TEST--
http_redirect() permanent
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
http_redirect('redirect', null, false, true);
?>
--EXPECTF--
Status: 301
Content-type: text/html
X-Powered-By: PHP/%s
Location: http://localhost/redirect
Redirecting to <a href="http://localhost/redirect">http://localhost/redirect</a>.
http://cvs.php.net/co.php/pecl/http/tests/030_send_data.phpt?r=1.1&p=1
Index: pecl/http/tests/030_send_data.phpt
+++ pecl/http/tests/030_send_data.phpt
--TEST--
http_send_data()
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
http_content_type('text/plain');
http_send_data(str_repeat('123abc', 1));
?>
--EXPECTREGEX--..+\s+.+\s+(abc|[123abc]{,100000})
http://cvs.php.net/co.php/pecl/http/tests/040_chunked_decode.phpt?r=1.1&p=1
Index: pecl/http/tests/040_chunked_decode.phpt
+++ pecl/http/tests/040_chunked_decode.phpt
--TEST--
http_chunked_decode()
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
$data =
"02\r\n".
"ab\r\n".
"03\r\n".
"a\nc\r\n".
"04\r\n".
"abcd\r\n".
"0\r\n".
"abracadabra\n";
var_dump(http_chunked_decode($data));
?>
--EXPECTF--
Content-type: text/html
X-Powered-By: PHP/%s
string(9) "aba
cabcd"
http://cvs.php.net/co.php/pecl/http/tests/050_split_response.phpt?r=1.1&p=1
Index: pecl/http/tests/050_split_response.phpt
+++ pecl/http/tests/050_split_response.phpt
--TEST--
http_split_response()
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
var_export(http_split_response("HTTP/1.1 200 Ok\r\nContent-Type:
text/plain\r\nContent-Language: de-AT\r\nDate: Sat, 22 Jan 2005 18:10:02 GMT\r\n\r\nHallo
Du!)"));
?>
--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!',
)
http://cvs.php.net/co.php/pecl/http/tests/051_parse_headers.phpt?r=1.1&p=1
Index: pecl/http/tests/051_parse_headers.phpt
+++ pecl/http/tests/051_parse_headers.phpt
--TEST--
http_parse_headers()
--SKIPIF--
<?php
extension_loaded('http') or die('ext/http not available');
strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI');
?>
--FILE--
<?php
print_r(http_parse_headers(
"Host: localhost\r\n".
"Nospace:here\r\n".
"Muchspace: there \r\n".
"Empty:\r\n".
"Empty2: \r\n".
": invalid\r\n".
" : bogus\r\n".
"Folded: one\r\n".
"\ttwo\r\n".
" three\r\n".
"stop\r\n"
));
?>
--EXPECTF--
Content-type: text/html
X-Powered-By: PHP/%s
Array
(
[Host] => localhost
[Nospace] => here
[Muchspace] => there
[Empty] =>
[Empty2] =>
[Folded] => one
two
three
)