travis: allow_failures
[m6w6/ext-http] / tests / info001.phpt
1 --TEST--
2 invalid HTTP info
3 --SKIPIF--
4 <?php include "skipif.inc"; ?>
5 --FILE--
6 <?php
7
8 try {
9 var_dump(new http\Message("GET HTTP/1.1"));
10 } catch (Exception $e) {
11 echo $e, "\n";
12 }
13 try {
14 var_dump(new http\Message("GET HTTP/1.123"));
15 } catch (Exception $e) {
16 echo $e, "\n";
17 }
18 try {
19 var_dump(new http\Message("GETHTTP/1.1"));
20 } catch (Exception $e) {
21 echo $e, "\n";
22 }
23 var_dump(new http\Message("GET / HTTP/1.1"));
24 ?>
25 DONE
26 --EXPECTF--
27 http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\040' at pos 3 of 'GET HTTP/1.1' in %s
28 Stack trace:
29 #0 %s: http\Message->__construct('GET HTTP/1.1')
30 #1 {main}
31 http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\040' at pos 3 of 'GET HTTP/1.123' in %s
32 Stack trace:
33 #0 %s: http\Message->__construct('GET HTTP/1.123')
34 #1 {main}
35 http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\057' at pos 7 of 'GETHTTP/1.1' %s
36 Stack trace:
37 #0 %s: http\Message->__construct('GETHTTP/1.1')
38 #1 {main}
39 object(http\Message)#%d (9) {
40 ["type":protected]=>
41 int(1)
42 ["body":protected]=>
43 NULL
44 ["requestMethod":protected]=>
45 string(3) "GET"
46 ["requestUrl":protected]=>
47 string(1) "/"
48 ["responseStatus":protected]=>
49 string(0) ""
50 ["responseCode":protected]=>
51 int(0)
52 ["httpVersion":protected]=>
53 string(3) "1.1"
54 ["headers":protected]=>
55 array(0) {
56 }
57 ["parentMessage":protected]=>
58 NULL
59 }
60 DONE