Skip to content

Commit

Permalink
Add test for PHP7's Error.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Dec 9, 2017
1 parent 4951149 commit 18e5350
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/TestCase/Error/Middleware/ErrorHandlerMiddlewareTest.php
Expand Up @@ -146,6 +146,24 @@ public function testHandleException()
$this->assertContains('was not found', '' . $result->getBody());
}

/**
* 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
*
Expand Down

0 comments on commit 18e5350

Please sign in to comment.