Browse Source

Add test for PHP7's Error.

ADmad 8 years ago
parent
commit
18e53502ab
1 changed files with 18 additions and 0 deletions
  1. 18 0
      tests/TestCase/Error/Middleware/ErrorHandlerMiddlewareTest.php

+ 18 - 0
tests/TestCase/Error/Middleware/ErrorHandlerMiddlewareTest.php

@@ -147,6 +147,24 @@ class ErrorHandlerMiddlewareTest extends TestCase
     }
 
     /**
+     * Test handling PHP 7's Error instance.
+     *
+     * @return void
+     */
+    public function testHandlePHP7Error()
+    {
+        $this->skipIf(version_compare(PHP_VERSION, '7.0.0', '<'), 'Error class only exists since PHP 7.');
+
+        $middleware = new ErrorHandlerMiddleware();
+        $request = ServerRequestFactory::fromGlobals();
+        $response = new Response();
+        $error = new Error();
+
+        $result = $middleware->handleException($error, $request, $response);
+        $this->assertInstanceOf(Response::class, $result);
+    }
+
+    /**
      * Test rendering an error page logs errors
      *
      * @return void