rename info tests
authorMichael Wallner <mike@php.net>
Thu, 12 Feb 2015 21:44:11 +0000 (22:44 +0100)
committerMichael Wallner <mike@php.net>
Thu, 12 Feb 2015 21:44:11 +0000 (22:44 +0100)
tests/info.phpt [deleted file]
tests/info001.phpt [new file with mode: 0644]
tests/info002.phpt [new file with mode: 0644]
tests/info_001.phpt [deleted file]
tests/phpinfo.phpt [new file with mode: 0644]

diff --git a/tests/info.phpt b/tests/info.phpt
deleted file mode 100644 (file)
index 373cb45..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-phpinfo
---SKIPIF--
-<?php
-include "skipif.inc";
-?>
---FILE--
-<?php
-echo "Test\n";
-phpinfo(INFO_MODULES);
-?>
-Done
---EXPECTF--
-Test
-%a
-HTTP Support => enabled
-Extension Version => 2.%s
-%a
-Done
diff --git a/tests/info001.phpt b/tests/info001.phpt
new file mode 100644 (file)
index 0000000..370d70e
--- /dev/null
@@ -0,0 +1,60 @@
+--TEST--
+invalid HTTP info
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+try { 
+    var_dump(new http\Message("GET HTTP/1.1"));
+} catch (Exception $e) {
+    echo $e, "\n";
+}
+try { 
+    var_dump(new http\Message("GET HTTP/1.123"));
+} catch (Exception $e) {
+    echo $e, "\n";
+}
+try { 
+    var_dump(new http\Message("GETHTTP/1.1"));
+} catch (Exception $e) {
+    echo $e, "\n";
+}
+var_dump(new http\Message("GET / HTTP/1.1"));
+?>
+DONE
+--EXPECTF--
+exception 'http\Exception\BadMessageException' with message 'Could not parse message: GET HTTP/1.1' in %s
+Stack trace:
+#0 %s: http\Message->__construct('GET HTTP/1.1')
+#1 {main}
+exception 'http\Exception\BadMessageException' with message 'Could not parse message: GET HTTP/1.123' in %s
+Stack trace:
+#0 %s: http\Message->__construct('GET HTTP/1.123')
+#1 {main}
+exception 'http\Exception\BadMessageException' with message 'Could not parse message: GETHTTP/1.1' in %s
+Stack trace:
+#0 %s: http\Message->__construct('GETHTTP/1.1')
+#1 {main}
+object(http\Message)#%d (9) {
+  ["type":protected]=>
+  int(1)
+  ["body":protected]=>
+  NULL
+  ["requestMethod":protected]=>
+  string(3) "GET"
+  ["requestUrl":protected]=>
+  string(1) "/"
+  ["responseStatus":protected]=>
+  string(0) ""
+  ["responseCode":protected]=>
+  int(0)
+  ["httpVersion":protected]=>
+  string(3) "1.1"
+  ["headers":protected]=>
+  array(0) {
+  }
+  ["parentMessage":protected]=>
+  NULL
+}
+DONE
diff --git a/tests/info002.phpt b/tests/info002.phpt
new file mode 100644 (file)
index 0000000..41bd7b4
--- /dev/null
@@ -0,0 +1,49 @@
+--TEST--
+invalid HTTP info
+--SKIPIF--
+<?php 
+include "skipif.inc";
+?>
+--FILE--
+<?php 
+
+echo "Test\n";
+
+function trap(callable $cb) {
+       try {
+               $cb();
+       } catch (Exception $e) { 
+               echo $e,"\n"; 
+       }
+}
+
+trap(function() {
+       echo new http\Message("HTTP/1.1 99 Apples in my Basket");
+});
+
+trap(function() {
+       echo new http\Message("CONNECT HTTP/1.1");
+});
+
+echo new http\Message("HTTP/1.1");
+echo new http\Message("CONNECT www.example.org:80 HTTP/1.1");
+
+?>
+===DONE===
+--EXPECTF--
+Test
+exception 'http\Exception\BadMessageException' with message 'Could not parse message: HTTP/1.1 99 Apples in my ' in %sinfo002.php:%d
+Stack trace:
+#0 %sinfo002.php(%d): http\Message->__construct('HTTP/1.1 99 App...')
+#1 %sinfo002.php(%d): {closure}()
+#2 %sinfo002.php(%d): trap(Object(Closure))
+#3 {main}
+exception 'http\Exception\BadMessageException' with message 'Could not parse message: CONNECT HTTP/1.1' in %sinfo002.php:%d
+Stack trace:
+#0 %sinfo002.php(%d): http\Message->__construct('CONNECT HTTP/1....')
+#1 %sinfo002.php(%d): {closure}()
+#2 %sinfo002.php(%d): trap(Object(Closure))
+#3 {main}
+HTTP/1.1 200
+CONNECT www.example.org:80 HTTP/1.1
+===DONE===
diff --git a/tests/info_001.phpt b/tests/info_001.phpt
deleted file mode 100644 (file)
index 370d70e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-invalid HTTP info
---SKIPIF--
-<?php include "skipif.inc"; ?>
---FILE--
-<?php
-
-try { 
-    var_dump(new http\Message("GET HTTP/1.1"));
-} catch (Exception $e) {
-    echo $e, "\n";
-}
-try { 
-    var_dump(new http\Message("GET HTTP/1.123"));
-} catch (Exception $e) {
-    echo $e, "\n";
-}
-try { 
-    var_dump(new http\Message("GETHTTP/1.1"));
-} catch (Exception $e) {
-    echo $e, "\n";
-}
-var_dump(new http\Message("GET / HTTP/1.1"));
-?>
-DONE
---EXPECTF--
-exception 'http\Exception\BadMessageException' with message 'Could not parse message: GET HTTP/1.1' in %s
-Stack trace:
-#0 %s: http\Message->__construct('GET HTTP/1.1')
-#1 {main}
-exception 'http\Exception\BadMessageException' with message 'Could not parse message: GET HTTP/1.123' in %s
-Stack trace:
-#0 %s: http\Message->__construct('GET HTTP/1.123')
-#1 {main}
-exception 'http\Exception\BadMessageException' with message 'Could not parse message: GETHTTP/1.1' in %s
-Stack trace:
-#0 %s: http\Message->__construct('GETHTTP/1.1')
-#1 {main}
-object(http\Message)#%d (9) {
-  ["type":protected]=>
-  int(1)
-  ["body":protected]=>
-  NULL
-  ["requestMethod":protected]=>
-  string(3) "GET"
-  ["requestUrl":protected]=>
-  string(1) "/"
-  ["responseStatus":protected]=>
-  string(0) ""
-  ["responseCode":protected]=>
-  int(0)
-  ["httpVersion":protected]=>
-  string(3) "1.1"
-  ["headers":protected]=>
-  array(0) {
-  }
-  ["parentMessage":protected]=>
-  NULL
-}
-DONE
diff --git a/tests/phpinfo.phpt b/tests/phpinfo.phpt
new file mode 100644 (file)
index 0000000..373cb45
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+phpinfo
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+echo "Test\n";
+phpinfo(INFO_MODULES);
+?>
+Done
+--EXPECTF--
+Test
+%a
+HTTP Support => enabled
+Extension Version => 2.%s
+%a
+Done