branch off v1 as R_1_7
[m6w6/ext-http] / tests / HttpRequest_006.phpt
1 --TEST--
2 HttpRequest XMLRPC
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 checkext('xmlrpc');
7 checkcls('HttpRequest');
8 ?>
9 --FILE--
10 <?php
11 echo "-TEST\n";
12
13 $r = new HttpRequest('http://dev.iworks.at/ext-http/.print_request.php', HTTP_METH_POST);
14 $r->setContentType('text/xml');
15 $r->setBody(xmlrpc_encode_request('testMethod', array('foo' => 'bar')));
16 var_dump($r->send());
17 var_dump($r->send());
18 var_dump($r->send());
19
20 echo "Done\n";
21 ?>
22 --EXPECTF--
23 %aTEST
24 object(HttpMessage)#%d (%d) {
25 ["type:protected"]=>
26 int(2)
27 ["body:protected"]=>
28 string(309) "string(294) "<?xml version="1.0" encoding="iso-8859-1%s]>
29 <methodCall>
30 <methodName>testMethod</methodName>
31 <params>
32 <param>
33 <value>
34 <struct>
35 <member>
36 <name>foo</name>
37 <value>
38 <string>bar</string>
39 </value>
40 </member>
41 </struct>
42 </value>
43 </param>
44 </params>
45 </methodCall>
46 "
47 "
48 ["requestMethod:protected"]=>
49 string(0) ""
50 ["requestUrl:protected"]=>
51 string(0) ""
52 ["responseStatus:protected"]=>
53 string(2) "OK"
54 ["responseCode:protected"]=>
55 int(200)
56 ["httpVersion:protected"]=>
57 float(1.1)
58 ["headers:protected"]=>
59 array(6) {
60 %a
61 }
62 ["parentMessage:protected"]=>
63 NULL
64 }
65 object(HttpMessage)#%d (%d) {
66 ["type:protected"]=>
67 int(2)
68 ["body:protected"]=>
69 string(309) "string(294) "<?xml version="1.0" encoding="iso-8859-1%s]>
70 <methodCall>
71 <methodName>testMethod</methodName>
72 <params>
73 <param>
74 <value>
75 <struct>
76 <member>
77 <name>foo</name>
78 <value>
79 <string>bar</string>
80 </value>
81 </member>
82 </struct>
83 </value>
84 </param>
85 </params>
86 </methodCall>
87 "
88 "
89 ["requestMethod:protected"]=>
90 string(0) ""
91 ["requestUrl:protected"]=>
92 string(0) ""
93 ["responseStatus:protected"]=>
94 string(2) "OK"
95 ["responseCode:protected"]=>
96 int(200)
97 ["httpVersion:protected"]=>
98 float(1.1)
99 ["headers:protected"]=>
100 array(6) {
101 %a
102 }
103 ["parentMessage:protected"]=>
104 NULL
105 }
106 object(HttpMessage)#%d (%d) {
107 ["type:protected"]=>
108 int(2)
109 ["body:protected"]=>
110 string(309) "string(294) "<?xml version="1.0" encoding="iso-8859-1%s]>
111 <methodCall>
112 <methodName>testMethod</methodName>
113 <params>
114 <param>
115 <value>
116 <struct>
117 <member>
118 <name>foo</name>
119 <value>
120 <string>bar</string>
121 </value>
122 </member>
123 </struct>
124 </value>
125 </param>
126 </params>
127 </methodCall>
128 "
129 "
130 ["requestMethod:protected"]=>
131 string(0) ""
132 ["requestUrl:protected"]=>
133 string(0) ""
134 ["responseStatus:protected"]=>
135 string(2) "OK"
136 ["responseCode:protected"]=>
137 int(200)
138 ["httpVersion:protected"]=>
139 float(1.1)
140 ["headers:protected"]=>
141 array(6) {
142 %a
143 }
144 ["parentMessage:protected"]=>
145 NULL
146 }
147 Done