WhoopsTest: Fixed non unique setApplicationPaths mocks

main
Igor Scheller 5 years ago
parent 4a6f18d41f
commit 2e1fbfb16d

@ -6,9 +6,9 @@ use Engelsystem\Application;
use Engelsystem\Exceptions\Handlers\Whoops; use Engelsystem\Exceptions\Handlers\Whoops;
use Engelsystem\Helpers\Authenticator; use Engelsystem\Helpers\Authenticator;
use Engelsystem\Http\Request; use Engelsystem\Http\Request;
use Engelsystem\Test\Unit\TestCase;
use Exception; use Exception;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Whoops\Handler\JsonResponseHandler; use Whoops\Handler\JsonResponseHandler;
use Whoops\Handler\PrettyPageHandler; use Whoops\Handler\PrettyPageHandler;
use Whoops\Run as WhoopsRunner; use Whoops\Run as WhoopsRunner;
@ -40,26 +40,13 @@ class WhoopsTest extends TestCase
/** @var Exception|MockObject $exception */ /** @var Exception|MockObject $exception */
$exception = $this->createMock(Exception::class); $exception = $this->createMock(Exception::class);
$request->expects($this->once()) $this->setExpects($request, 'isXmlHttpRequest', null, true);
->method('isXmlHttpRequest')
->willReturn(true);
$prettyPageHandler $this->setExpects($prettyPageHandler, 'setApplicationPaths');
->expects($this->atLeastOnce()) $this->setExpects($prettyPageHandler, 'addDataTable');
->method('setApplicationPaths');
$prettyPageHandler
->expects($this->once())
->method('setApplicationPaths');
$prettyPageHandler
->expects($this->once())
->method('addDataTable');
$jsonResponseHandler->expects($this->once()) $this->setExpects($jsonResponseHandler, 'setJsonApi', [true]);
->method('setJsonApi') $this->setExpects($jsonResponseHandler, 'addTraceToOutput', [true]);
->with(true);
$jsonResponseHandler->expects($this->once())
->method('addTraceToOutput')
->with(true);
$app->expects($this->exactly(3)) $app->expects($this->exactly(3))
->method('make') ->method('make')
@ -93,18 +80,9 @@ class WhoopsTest extends TestCase
[$prettyPageHandler], [$prettyPageHandler],
[$jsonResponseHandler] [$jsonResponseHandler]
); );
$whoopsRunner $this->setExpects($whoopsRunner, 'writeToOutput', [false]);
->expects($this->once()) $this->setExpects($whoopsRunner, 'allowQuit', [false]);
->method('writeToOutput') $this->setExpects($whoopsRunner, 'handleException', [$exception]);
->with(false);
$whoopsRunner
->expects($this->once())
->method('allowQuit')
->with(false);
$whoopsRunner
->expects($this->once())
->method('handleException')
->with($exception);
$handler = new Whoops($app); $handler = new Whoops($app);
$handler->render($request, $exception); $handler->render($request, $exception);

Loading…
Cancel
Save