- changelog
[m6w6/ext-http] / tests / HttpQueryString_002.phpt
1 --TEST--
2 HttpQueryString local
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 checkmin(5);
7 ?>
8 --FILE--
9 <?php
10 echo "-TEST\n";
11
12 $q = new HttpQueryString(false, $array = array('a'=>'b','c'=>'3.4','r'=>array(1,2,3)));
13 var_dump($q->get());
14 var_dump($q->get('n'));
15 var_dump($q->get('a'));
16 var_dump($q->get('a', "i", 0, true));
17 var_dump($q->get('a', "string", 'hi!'));
18 var_dump($q->get('c'));
19 var_dump($q->get('c', HttpQueryString::TYPE_INT));
20 var_dump($q->get('c', HttpQueryString::TYPE_FLOAT));
21 var_dump($q->get('c', HttpQueryString::TYPE_BOOL));
22 var_dump($q->get('r'));
23 var_dump($q->get('r', HttpQueryString::TYPE_ARRAY));
24 var_dump($q->get('r', HttpQueryString::TYPE_OBJECT));
25
26 $q->set('z[0]=2');
27 $q->set(array('a'=>'b', 'c'=> "3.4"));
28 $q->set(array('a' => NULL));
29
30 var_dump($q);
31 var_dump($array);
32
33 echo "Done\n";
34 ?>
35 --EXPECTF--
36 %sTEST
37 string(42) "a=b&c=3.4&r%5B0%5D=1&r%5B1%5D=2&r%5B2%5D=3"
38 NULL
39 string(1) "b"
40 int(0)
41 string(3) "hi!"
42 string(3) "3.4"
43 int(3)
44 float(3.4)
45 bool(true)
46 array(3) {
47 [0]=>
48 int(1)
49 [1]=>
50 int(2)
51 [2]=>
52 int(3)
53 }
54 array(3) {
55 [0]=>
56 int(1)
57 [1]=>
58 int(2)
59 [2]=>
60 int(3)
61 }
62 object(stdClass)#%d (%d) {
63 [0]=>
64 int(1)
65 [1]=>
66 int(2)
67 [2]=>
68 int(3)
69 }
70 object(HttpQueryString)#1 (2) {
71 ["queryArray:private"]=>
72 array(3) {
73 ["c"]=>
74 string(3) "3.4"
75 ["r"]=>
76 array(3) {
77 [0]=>
78 int(1)
79 [1]=>
80 int(2)
81 [2]=>
82 int(3)
83 }
84 ["z"]=>
85 array(1) {
86 [0]=>
87 string(1) "2"
88 }
89 }
90 ["queryString:private"]=>
91 string(49) "c=3.4&r%5B0%5D=1&r%5B1%5D=2&r%5B2%5D=3&z%5B0%5D=2"
92 }
93 array(3) {
94 ["a"]=>
95 string(1) "b"
96 ["c"]=>
97 string(3) "3.4"
98 ["r"]=>
99 array(3) {
100 [0]=>
101 int(1)
102 [1]=>
103 int(2)
104 [2]=>
105 int(3)
106 }
107 }
108 Done