Merge branch 'DEV_2' into HEAD
[m6w6/ext-http] / tests / message002.phpt
1 --TEST--
2 env request message
3 --SKIPIF--
4 <?php include "skipif.inc"; ?>
5 --POST_RAW--
6 Content-Type: test/something
7 b=c
8 --ENV--
9 HTTP_X_TEST=test
10 --COOKIE--
11 foo=bar
12 --FILE--
13 <?
14 echo "Test\n";
15
16 use http\env\Request as HttpEnvRequest;
17
18 $m = new HttpEnvRequest();
19
20 var_dump($m);
21
22 echo "Message->toString\n";
23 echo $m,"\n";
24
25 echo "Body->toString\n";
26 var_dump((string)$m->getBody());
27
28 echo "stream\n";
29 var_dump(file_get_contents("php://input"));
30
31 echo "Done\n";
32 --EXPECTF--
33 Test
34 object(%s)#%d (12) {
35 ["type":protected]=>
36 int(1)
37 ["body":protected]=>
38 object(http\Message\Body)#%d (0) {
39 }
40 ["requestMethod":protected]=>
41 string(4) "POST"
42 ["requestUrl":protected]=>
43 string(0) ""
44 ["responseStatus":protected]=>
45 string(0) ""
46 ["responseCode":protected]=>
47 int(0)
48 ["httpVersion":protected]=>
49 string(3) "1.1"
50 ["headers":protected]=>
51 array(4) {
52 ["X-Test"]=>
53 string(4) "test"
54 ["Content-Length"]=>
55 string(1) "3"
56 ["Content-Type"]=>
57 string(14) "test/something"
58 ["Cookie"]=>
59 string(7) "foo=bar"
60 }
61 ["parentMessage":protected]=>
62 NULL
63 ["query":protected]=>
64 object(http\QueryString)#2 (1) {
65 ["queryArray":"http\QueryString":private]=>
66 array(0) {
67 }
68 }
69 ["form":protected]=>
70 object(http\QueryString)#3 (1) {
71 ["queryArray":"http\QueryString":private]=>
72 array(0) {
73 }
74 }
75 ["files":protected]=>
76 array(0) {
77 }
78 }
79 Message->toString
80 POST / HTTP/1.1%a
81 X-Test: test%a
82 Content-Length: 3%a
83 Content-Type: test/something%a
84 Cookie: foo=bar%a
85 %a
86 b=c
87 Body->toString
88 string(3) "b=c"
89 stream
90 string(3) "b=c"
91 Done