summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2002-11-19 16:56:43 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2002-11-19 16:56:43 +0000
commit65677445b4aa2bfa35e2261c2f3404c978889496 (patch)
tree54b65bb9d16c105c11e36a9e1cb1e24a7eea6ae7
parent18089ce360f0984da033e81ecb54adec75ec482d (diff)
downloadphp-git-65677445b4aa2bfa35e2261c2f3404c978889496.tar.gz
Added a test to check whether mb_parse_str() works properly
-rw-r--r--ext/mbstring/tests/mb_parse_str.phpt79
1 files changed, 79 insertions, 0 deletions
diff --git a/ext/mbstring/tests/mb_parse_str.phpt b/ext/mbstring/tests/mb_parse_str.phpt
new file mode 100644
index 0000000000..fcfbbd9fe4
--- /dev/null
+++ b/ext/mbstring/tests/mb_parse_str.phpt
@@ -0,0 +1,79 @@
+--TEST--
+mb_parse_str()
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--INI--
+arg_separator.input=&
+--FILE--
+<?php
+$queries = array(
+ "foo=abc&bar=def",
+ "%2bfoo=def&-bar=jkl",
+ "foo[]=abc&foo[]=def&foo[]=ghi&bar[]=jkl"
+);
+function test($query) {
+ $foo = '';
+ $bar = '';
+ mb_parse_str($query, $array);
+ var_dump($array);
+ var_dump($foo);
+ var_dump($bar);
+ mb_parse_str($query);
+ var_dump($foo);
+ var_dump($bar);
+}
+foreach ($queries as $query) {
+ test($query);
+}
+?>
+--EXPECT--
+array(2) {
+ ["foo"]=>
+ string(3) "abc"
+ ["bar"]=>
+ string(3) "def"
+}
+string(0) ""
+string(0) ""
+string(3) "abc"
+string(3) "def"
+array(2) {
+ ["+foo"]=>
+ string(3) "def"
+ ["-bar"]=>
+ string(3) "jkl"
+}
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+array(2) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ string(3) "abc"
+ [1]=>
+ string(3) "def"
+ [2]=>
+ string(3) "ghi"
+ }
+ ["bar"]=>
+ array(1) {
+ [0]=>
+ string(3) "jkl"
+ }
+}
+string(0) ""
+string(0) ""
+array(3) {
+ [0]=>
+ string(3) "abc"
+ [1]=>
+ string(3) "def"
+ [2]=>
+ string(3) "ghi"
+}
+array(1) {
+ [0]=>
+ string(3) "jkl"
+}