test reafactoring; release beta5
[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 $m->setRequestUrl("/foo");
14 $m->setType(http\Message::TYPE_REQUEST);
15 $m->setRequestUrl("");
16
17 $m = new http\Message;
18 try {
19 $m->getParentMessage();
20 die("unreached");
21 } catch (http\Exception $e) {
22 var_dump($e->getMessage());
23 }
24
25 $m = new http\Message("HTTP/1.1 200\r\nHTTP/1.1 201");
26 try {
27 $m->prepend($m->getParentMessage());
28 die("unreached");
29 } catch (http\Exception $e) {
30 var_dump($e->getMessage());
31 }
32
33 ?>
34 Done
35 --EXPECTF--
36 Test
37
38 Notice: http\Message::setRequestUrl(): HttpMessage is not of type REQUEST in %s on line %d
39
40 Warning: http\Message::setRequestUrl(): Cannot set HttpMessage::requestUrl to an empty string in %s on line %d
41 string(42) "HttpMessage does not have a parent message"
42 string(62) "Cannot prepend a message located within the same message chain"
43 Done