- class HttpRequestPool implements Countable
[m6w6/ext-http] / tests / HttpMessage_003.phpt
1 --TEST--
2 HttpMessage implmenets Serializable, Countable
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 checkmin(5);
7 ?>
8 --FILE--
9 <?php
10 echo "-TEST\n";
11
12 $m = new HttpMessage(
13 "HTTP/1.1 301\r\n".
14 "Location: /anywhere\r\n".
15 "HTTP/1.1 302\r\n".
16 "Location: /somewhere\r\n".
17 "HTTP/1.1 200\r\n".
18 "Transfer-Encoding: chunked\r\n".
19 "\r\n".
20 "01\r\n".
21 "X\r\n".
22 "00"
23 );
24
25 var_dump($m->count());
26 var_dump($m->serialize());
27 $m->unserialize("HTTP/1.1 200 Ok\r\nServer: Funky/1.0");
28 var_dump($m);
29 var_dump($m->count());
30
31 echo "Done\n";
32 ?>
33 --EXPECTF--
34 %sTEST
35 int(3)
36 string(109) "HTTP/1.1 301
37 Location: /anywhere
38 HTTP/1.1 302
39 Location: /somewhere
40 HTTP/1.1 200
41 Content-Length: 1
42
43 X
44 "
45 object(HttpMessage)#%d (%d) {
46 ["type:protected"]=>
47 int(2)
48 ["httpVersion:protected"]=>
49 float(1.1)
50 ["responseCode:protected"]=>
51 int(200)
52 ["responseStatus:protected"]=>
53 string(2) "Ok"
54 ["requestMethod:protected"]=>
55 string(0) ""
56 ["requestUri:protected"]=>
57 string(0) ""
58 ["headers:protected"]=>
59 array(1) {
60 ["Server"]=>
61 string(9) "Funky/1.0"
62 }
63 ["body:protected"]=>
64 string(0) ""
65 }
66 int(1)
67 Done