Fix gh-issue #6
[m6w6/ext-http] / tests / messagebody004.phpt
1 --TEST--
2 message body add form
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(
14 "foo" => "bar",
15 "more" => array(
16 "bah", "baz", "fuz"
17 ),
18 ),
19 array(
20 array(
21 "file" => __FILE__,
22 "name" => "upload",
23 "type" => "text/plain",
24 )
25 )
26 );
27
28 echo $temp;
29
30 ?>
31 DONE
32 --EXPECTF--
33 Test
34 --%x.%x
35 Content-Disposition: form-data; name="foo"
36
37 bar
38 --%x.%x
39 Content-Disposition: form-data; name="more[0]"
40
41 bah
42 --%x.%x
43 Content-Disposition: form-data; name="more[1]"
44
45 baz
46 --%x.%x
47 Content-Disposition: form-data; name="more[2]"
48
49 fuz
50 --%x.%x
51 Content-Disposition: form-data; name="upload"; filename="%s"
52 Content-Transfer-Encoding: binary
53 Content-Type: text/plain
54
55 <?php
56 echo "Test\n";
57
58 $temp = new http\Message\Body;
59 $temp->addForm(
60 array(
61 "foo" => "bar",
62 "more" => array(
63 "bah", "baz", "fuz"
64 ),
65 ),
66 array(
67 array(
68 "file" => __FILE__,
69 "name" => "upload",
70 "type" => "text/plain",
71 )
72 )
73 );
74
75 echo $temp;
76
77 ?>
78 DONE
79
80 --%x.%x--
81 DONE