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