Added tests for new parse_url() and http_build_query() functionality.

This commit is contained in:
Ilia Alshanetsky 2005-12-04 17:58:15 +00:00
parent 2994c23670
commit 66fbae9d75
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,15 @@
--TEST--
http_build_query() function
--FILE--
<?php
$array = array("foo"=>"bar","baz"=>1,"test"=>"a ' \" ", "abc");
var_dump(http_build_query($array));
var_dump(http_build_query($array, 'foo'));
var_dump(http_build_query($array, 'foo', ';'));
?>
--EXPECT--
string(35) "foo=bar&baz=1&test=a+%27+%22+&0=abc"
string(38) "foo=bar&baz=1&test=a+%27+%22+&foo0=abc"
string(38) "foo=bar;baz=1;test=a+%27+%22+;foo0=abc"

View File

@ -75,6 +75,11 @@ $sample_urls = array (
foreach ($sample_urls as $url) {
var_dump(@parse_url($url));
}
$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
foreach (array(PHP_URL_SCHEME,PHP_URL_HOST,PHP_URL_PORT,PHP_URL_USER,PHP_URL_PASS,PHP_URL_PATH,PHP_URL_QUERY,PHP_URL_FRAGMENT) as $v) {
var_dump(parse_url($url, $v));
}
?>
--EXPECT--
array(1) {
@ -673,3 +678,11 @@ array(4) {
["path"]=>
string(4) "/bla"
}
string(4) "http"
string(11) "www.php.net"
int(80)
string(6) "secret"
string(7) "hideout"
string(10) "/index.php"
string(31) "test=1&test2=char&test3=mixesCI"
string(16) "some_page_ref123"