6466d6e22d9e33dc45e16a397320897fd2eb58a0
[m6w6/ext-http] / tests / HttpMessage_005.phpt
1 --TEST--
2 HttpMessage::prepend()
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 checkver(5);
7 ?>
8 --FILE--
9 <?php
10 echo "-TEST\n";
11
12 $m1 = new HttpMessage("
13 GET / HTTP/1.1
14 Host: example.com
15 Accept: */*
16 Connection: close
17 HTTP/1.1 200 ok
18 Server: Funky/1.0
19 Content-Type: text/plain
20 Content-Length: 3
21
22 Hi!"
23 );
24
25 $m2 = new HttpMessage("
26 GET http://example.com/ HTTP/1.0
27 HTTP/1.1 200 ok
28 Server: Funky/2.0
29 Content-Type: text/html
30 Content-Length: 9
31
32 Hi there!"
33 );
34
35 $m1->prepend($m2);
36 $m2 = NULL;
37 echo $m1->toString(true);
38
39 $m1->prepend($m1->detach(), false);
40 echo $m1->toString(true);
41
42 echo "Done\n";
43 ?>
44 --EXPECTF--
45 %sTEST
46 GET http://example.com/ HTTP/1.0
47 HTTP/1.1 200 ok
48 Server: Funky/2.0
49 Content-Type: text/html
50 Content-Length: 9
51
52 Hi there!
53 GET / HTTP/1.1
54 Host: example.com
55 Accept: */*
56 Connection: close
57 HTTP/1.1 200 ok
58 Server: Funky/1.0
59 Content-Type: text/plain
60 Content-Length: 3
61
62 Hi!
63 GET http://example.com/ HTTP/1.0
64 HTTP/1.1 200 ok
65 Server: Funky/2.0
66 Content-Type: text/html
67 Content-Length: 9
68
69 Hi there!
70 GET / HTTP/1.1
71 Host: example.com
72 Accept: */*
73 Connection: close
74 HTTP/1.1 200 ok
75 Server: Funky/1.0
76 Content-Type: text/plain
77 Content-Length: 3
78
79 Hi!
80 HTTP/1.1 200 ok
81 Server: Funky/1.0
82 Content-Type: text/plain
83 Content-Length: 3
84
85 Hi!
86 Done