summaryrefslogtreecommitdiff
path: root/tests/Unit/Exceptions
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-10-08 19:30:37 +0200
committermsquare <msquare@notrademark.de>2018-10-31 13:43:23 +0100
commitd15946df2dfb0ae2f0ca9371e5c8071df91ab45a (patch)
tree49601aafd74da5a781920543ed92bbd180fe5e89 /tests/Unit/Exceptions
parent8e62c4c52c27f9432820915deeb699c3d1f58ce7 (diff)
Changed `src/` code and templates to use the new user model
Diffstat (limited to 'tests/Unit/Exceptions')
-rw-r--r--tests/Unit/Exceptions/Handlers/WhoopsTest.php32
1 files changed, 25 insertions, 7 deletions
diff --git a/tests/Unit/Exceptions/Handlers/WhoopsTest.php b/tests/Unit/Exceptions/Handlers/WhoopsTest.php
index 4062979b..4949c45a 100644
--- a/tests/Unit/Exceptions/Handlers/WhoopsTest.php
+++ b/tests/Unit/Exceptions/Handlers/WhoopsTest.php
@@ -5,6 +5,7 @@ namespace Engelsystem\Test\Unit\Exceptions\handlers;
use Engelsystem\Application;
use Engelsystem\Exceptions\Handlers\Whoops;
+use Engelsystem\Helpers\Authenticator;
use Engelsystem\Http\Request;
use Exception;
use PHPUnit\Framework\TestCase;
@@ -23,15 +24,23 @@ class WhoopsTest extends TestCase
{
/** @var Application|Mock $app */
$app = $this->createMock(Application::class);
+ /** @var Authenticator|Mock $auth */
+ $auth = $this->createMock(Authenticator::class);
/** @var Request|Mock $request */
$request = $this->createMock(Request::class);
- $request->expects($this->once())
- ->method('isXmlHttpRequest')
- ->willReturn(true);
/** @var WhoopsRunnerInterface|Mock $whoopsRunner */
$whoopsRunner = $this->getMockForAbstractClass(WhoopsRunnerInterface::class);
/** @var PrettyPageHandler|Mock $prettyPageHandler */
$prettyPageHandler = $this->createMock(PrettyPageHandler::class);
+ /** @var JsonResponseHandler|Mock $jsonResponseHandler */
+ $jsonResponseHandler = $this->createMock(JsonResponseHandler::class);
+ /** @var Exception|Mock $exception */
+ $exception = $this->createMock(Exception::class);
+
+ $request->expects($this->once())
+ ->method('isXmlHttpRequest')
+ ->willReturn(true);
+
$prettyPageHandler
->expects($this->atLeastOnce())
->method('setApplicationPaths');
@@ -41,16 +50,13 @@ class WhoopsTest extends TestCase
$prettyPageHandler
->expects($this->once())
->method('addDataTable');
- /** @var JsonResponseHandler|Mock $jsonResponseHandler */
- $jsonResponseHandler = $this->createMock(JsonResponseHandler::class);
+
$jsonResponseHandler->expects($this->once())
->method('setJsonApi')
->with(true);
$jsonResponseHandler->expects($this->once())
->method('addTraceToOutput')
->with(true);
- /** @var Exception|Mock $exception */
- $exception = $this->createMock(Exception::class);
$app->expects($this->exactly(3))
->method('make')
@@ -64,6 +70,18 @@ class WhoopsTest extends TestCase
$prettyPageHandler,
$jsonResponseHandler
);
+ $app->expects($this->once())
+ ->method('has')
+ ->with('authenticator')
+ ->willReturn(true);
+ $app->expects($this->once())
+ ->method('get')
+ ->with('authenticator')
+ ->willReturn($auth);
+
+ $auth->expects($this->once())
+ ->method('user')
+ ->willReturn(null);
$whoopsRunner
->expects($this->exactly(2))