Fix gh-issue #7
[m6w6/ext-http] / tests / message015.phpt
1 --TEST--
2 message errors
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 ?>
7 --FILE--
8 <?php
9
10 echo "Test\n";
11
12 $m = new http\Message;
13 try {
14 $m->setRequestUrl("/foo");
15 } catch (http\Exception $e) {
16 echo $e->getMessage(),"\n";
17 }
18 $m->setType(http\Message::TYPE_REQUEST);
19 try {
20 $m->setRequestUrl("");
21 } catch (http\Exception $e) {
22 echo $e->getMessage(),"\n";
23 }
24
25 $m = new http\Message;
26 try {
27 $m->getParentMessage();
28 die("unreached");
29 } catch (http\Exception $e) {
30 echo $e->getMessage(),"\n";
31 }
32
33 $m = new http\Message("HTTP/1.1 200\r\nHTTP/1.1 201");
34 try {
35 $m->prepend($m->getParentMessage());
36 die("unreached");
37 } catch (http\Exception $e) {
38 echo $e->getMessage(),"\n";
39 }
40
41 ?>
42 Done
43 --EXPECTF--
44 Test
45 http\Message is not of type request
46 Cannot set http\Message's request url to an empty string
47 http\Message has not parent message
48 Cannot prepend a message located within the same message chain
49 Done