- simple message test
[m6w6/ext-http] / tests / HttpMessage_001.phpt
1 --TEST--
2 HttpMessage simple redirects
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 (5 > (int) PHP_VERSION) and die('skip PHP5 is required for Http classes');
7 ?>
8 --FILE--
9 <?php
10 $m = new HttpMessage(
11 "HTTP/1.1 301\r\n".
12 "Location: /anywhere\r\n".
13 "HTTP/1.1 302\r\n".
14 "Location: /somwhere\r\n".
15 "HTTP/1.1 206\r\n".
16 "Content-Range: bytes=2-3\r\n".
17 "Transfer-Encoding: chunked\r\n".
18 "\r\n".
19 "01\r\n".
20 "X\r\n".
21 "00"
22 );
23
24 var_dump($m->getBody());
25 var_dump($m->toString());
26 var_dump(HttpMessage::fromString($m->toString())->toString());
27 ?>
28 --EXPECTF--
29 Content-type: text/html
30 X-Powered-By: PHP/%s
31
32 string(1) "X"
33 string(134) "HTTP/1.1 301
34 Location: /anywhere
35 HTTP/1.1 302
36 Location: /somwhere
37 HTTP/1.1 206
38 Content-Range: bytes=2-3
39 Content-Length: 1
40
41 X
42 "
43 string(134) "HTTP/1.1 301
44 Location: /anywhere
45 HTTP/1.1 302
46 Location: /somwhere
47 HTTP/1.1 206
48 Content-Range: bytes=2-3
49 Content-Length: 1
50
51 X
52 "