mirror of
https://github.com/php/php-src.git
synced 2024-11-27 20:03:40 +08:00
Added tests for new parse_url() and http_build_query() functionality.
This commit is contained in:
parent
2994c23670
commit
66fbae9d75
15
ext/standard/tests/strings/http_build_query.phpt
Normal file
15
ext/standard/tests/strings/http_build_query.phpt
Normal 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"
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user