X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2Fparams004.phpt;fp=tests%2Fparams004.phpt;h=69075ea2d49a2f3603aa70408ac88063f9add1d3;hp=0000000000000000000000000000000000000000;hb=c329d4dabccd5caff9869d88be4e14f477e028b6;hpb=e1de6f2d6a6f2e2707c1b4998317e457ed8de4a4 diff --git a/tests/params004.phpt b/tests/params004.phpt new file mode 100644 index 0000000..69075ea --- /dev/null +++ b/tests/params004.phpt @@ -0,0 +1,97 @@ +--TEST-- +custom params +--SKIPIF-- + +--FILE-- +"arg", "bar"=>"bla", "gotit"=>"now"); +$r = array ( + 'foo' => + array ( + 'value' => true, + 'arguments' => + array ( + ), + ), + 'bar' => + array ( + 'value' => true, + 'arguments' => + array ( + 'arg' => '0', + 'bla' => true, + ), + ), + 'gotit' => + array ( + 'value' => '0', + 'arguments' => + array ( + 'now' => true, + ), + ), +); + +# --- + +var_dump(count($p->params)); + +echo "key exists\n"; +foreach ($k as $key) { + var_dump(array_key_exists($key, $p->params)); +} + +echo "values\n"; +foreach ($k as $key) { + var_dump($p[$key]["value"]); +} + +echo "args\n"; +foreach ($k as $key) { + var_dump(count($p[$key]["arguments"])); +} + +echo "arg values\n"; +foreach ($k as $key) { + var_dump(@$p[$key]["arguments"][$a[$key]]); +} + +echo "equals\n"; +var_dump($c === (string) $p); +var_dump($r === $p->params); +$x = new http\Params($p->params); +var_dump($r === $x->toArray()); +?> +DONE +--EXPECT-- +Test +int(3) +key exists +bool(true) +bool(true) +bool(true) +values +bool(true) +bool(true) +string(1) "0" +args +int(0) +int(2) +int(1) +arg values +NULL +bool(true) +bool(true) +equals +bool(true) +bool(true) +bool(true) +DONE