Config.w32 chack for both instances of event.h
[m6w6/ext-http] / tests / gh-issue92.phpt
1 --TEST--
2 gh-issue #93: message body add form ignores numeric indices
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 ?>
7 --FILE--
8 <?php
9 echo "Test\n";
10
11 $temp = new http\Message\Body;
12 $temp->addForm(
13 array("foo", "bar", "baz"),
14 array(
15 array(
16 "file" => __FILE__,
17 "name" => "upload",
18 "type" => "text/plain",
19 ),
20 "dir" => array(
21 array(
22 "file" => __FILE__,
23 "name" => 1,
24 "type" => "text/plain",
25 ),
26 array(
27 "file" => __FILE__,
28 "name" => 2,
29 "type" => "text/plain",
30 ),
31 ),
32 )
33 );
34
35 echo $temp;
36
37 ?>
38 DONE
39 --EXPECTF--
40 Test
41 --%x.%x
42 Content-Disposition: form-data; name="0"
43
44 foo
45 --%x.%x
46 Content-Disposition: form-data; name="1"
47
48 bar
49 --%x.%x
50 Content-Disposition: form-data; name="2"
51
52 baz
53 --%x.%x
54 Content-Disposition: form-data; name="upload"; filename="gh-issue92.php"
55 Content-Transfer-Encoding: binary
56 Content-Type: text/plain
57
58 <?php
59 echo "Test\n";
60
61 $temp = new http\Message\Body;
62 $temp->addForm(
63 array("foo", "bar", "baz"),
64 array(
65 array(
66 "file" => __FILE__,
67 "name" => "upload",
68 "type" => "text/plain",
69 ),
70 "dir" => array(
71 array(
72 "file" => __FILE__,
73 "name" => 1,
74 "type" => "text/plain",
75 ),
76 array(
77 "file" => __FILE__,
78 "name" => 2,
79 "type" => "text/plain",
80 ),
81 ),
82 )
83 );
84
85 echo $temp;
86
87 ?>
88 DONE
89
90 --%x.%x
91 Content-Disposition: form-data; name="dir[1]"; filename="gh-issue92.php"
92 Content-Transfer-Encoding: binary
93 Content-Type: text/plain
94
95 <?php
96 echo "Test\n";
97
98 $temp = new http\Message\Body;
99 $temp->addForm(
100 array("foo", "bar", "baz"),
101 array(
102 array(
103 "file" => __FILE__,
104 "name" => "upload",
105 "type" => "text/plain",
106 ),
107 "dir" => array(
108 array(
109 "file" => __FILE__,
110 "name" => 1,
111 "type" => "text/plain",
112 ),
113 array(
114 "file" => __FILE__,
115 "name" => 2,
116 "type" => "text/plain",
117 ),
118 ),
119 )
120 );
121
122 echo $temp;
123
124 ?>
125 DONE
126
127 --%x.%x
128 Content-Disposition: form-data; name="dir[2]"; filename="gh-issue92.php"
129 Content-Transfer-Encoding: binary
130 Content-Type: text/plain
131
132 <?php
133 echo "Test\n";
134
135 $temp = new http\Message\Body;
136 $temp->addForm(
137 array("foo", "bar", "baz"),
138 array(
139 array(
140 "file" => __FILE__,
141 "name" => "upload",
142 "type" => "text/plain",
143 ),
144 "dir" => array(
145 array(
146 "file" => __FILE__,
147 "name" => 1,
148 "type" => "text/plain",
149 ),
150 array(
151 "file" => __FILE__,
152 "name" => 2,
153 "type" => "text/plain",
154 ),
155 ),
156 )
157 );
158
159 echo $temp;
160
161 ?>
162 DONE
163
164 --%x.%x--
165 DONE