Skip to content

Commit

Permalink
fix namespaced entities
Browse files Browse the repository at this point in the history
  • Loading branch information
l0gicgate committed Dec 10, 2019
1 parent 70c33c6 commit 7ea0a3d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/Middleware/ErrorMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
namespace Slim\Tests\Middleware;

use Error;
use InvalidArgumentException;
use LogicException;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\App;
Expand Down Expand Up @@ -106,9 +108,9 @@ public function testSuperclassExceptionHandlerHandlesExceptionWithSubclassExactM
$callableResolver = $app->getCallableResolver();
$mw = new ErrorMiddleware($callableResolver, $this->getResponseFactory(), false, false, false);
$app->add(function ($request, $handler) {
throw new \LogicException('This is a LogicException...');
throw new LogicException('This is a LogicException...');
});
$mw->setErrorHandler(\LogicException::class, (function (ServerRequestInterface $request, $exception) {
$mw->setErrorHandler(LogicException::class, (function (ServerRequestInterface $request, $exception) {
$response = $this->createResponse();
$response->getBody()->write($exception->getMessage());
return $response;
Expand Down Expand Up @@ -137,10 +139,10 @@ public function testSuperclassExceptionHandlerHandlesSubclassException()
$mw = new ErrorMiddleware($callableResolver, $this->getResponseFactory(), false, false, false);

$app->add(function ($request, $handler) {
throw new \InvalidArgumentException('This is a subclass of LogicException...');
throw new InvalidArgumentException('This is a subclass of LogicException...');
});

$mw->setErrorHandler(\LogicException::class, (function (ServerRequestInterface $request, $exception) {
$mw->setErrorHandler(LogicException::class, (function (ServerRequestInterface $request, $exception) {
$response = $this->createResponse();
$response->getBody()->write($exception->getMessage());
return $response;
Expand Down Expand Up @@ -174,10 +176,10 @@ public function testSuperclassExceptionHandlerDoesNotHandleSubclassException()
$mw = new ErrorMiddleware($callableResolver, $this->getResponseFactory(), false, false, false);

$app->add(function ($request, $handler) {
throw new \InvalidArgumentException('This is a subclass of LogicException...');
throw new InvalidArgumentException('This is a subclass of LogicException...');
});

$mw->setErrorHandler(\LogicException::class, (function (ServerRequestInterface $request, $exception) {
$mw->setErrorHandler(LogicException::class, (function (ServerRequestInterface $request, $exception) {
$response = $this->createResponse();
$response->getBody()->write($exception->getMessage());
return $response;
Expand Down

0 comments on commit 7ea0a3d

Please sign in to comment.