summaryrefslogtreecommitdiff
path: root/tests/Unit/Exceptions
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-09-03 22:43:19 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-09-03 22:55:54 +0200
commit36dafdb68acbde2fe42ce36ef50f497c8c06411f (patch)
tree1e420597ae72c979361bf29b66ae7e27c73cf431 /tests/Unit/Exceptions
parent9f1ee0c6c6497d43fb275491ec53fda420f64b81 (diff)
parentb0e7bc0df2eb4975223582089c7a928903e8cd14 (diff)
Merge remote-tracking branch 'MyIgel/rebuild-psr7'
Diffstat (limited to 'tests/Unit/Exceptions')
-rw-r--r--tests/Unit/Exceptions/HandlerTest.php14
-rw-r--r--tests/Unit/Exceptions/Handlers/WhoopsTest.php8
2 files changed, 19 insertions, 3 deletions
diff --git a/tests/Unit/Exceptions/HandlerTest.php b/tests/Unit/Exceptions/HandlerTest.php
index 5a6ffe16..58d25de3 100644
--- a/tests/Unit/Exceptions/HandlerTest.php
+++ b/tests/Unit/Exceptions/HandlerTest.php
@@ -49,15 +49,19 @@ class HandlerTest extends TestCase
public function testExceptionHandler()
{
$exception = new Exception();
+ $errorMessage = 'Oh noes, an error!';
/** @var HandlerInterface|Mock $handlerMock */
$handlerMock = $this->getMockForAbstractClass(HandlerInterface::class);
- $handlerMock->expects($this->once())
+ $handlerMock->expects($this->atLeastOnce())
->method('report')
->with($exception);
- $handlerMock->expects($this->once())
+ $handlerMock->expects($this->atLeastOnce())
->method('render')
- ->with($this->isInstanceOf(Request::class), $exception);
+ ->with($this->isInstanceOf(Request::class), $exception)
+ ->willReturnCallback(function () use ($errorMessage) {
+ echo $errorMessage;
+ });
/** @var Handler|Mock $handler */
$handler = $this->getMockBuilder(Handler::class)
@@ -68,7 +72,11 @@ class HandlerTest extends TestCase
$handler->setHandler(Handler::ENV_PRODUCTION, $handlerMock);
+ $this->expectOutputString($errorMessage);
$handler->exceptionHandler($exception);
+
+ $return = $handler->exceptionHandler($exception, true);
+ $this->assertEquals($errorMessage, $return);
}
/**
diff --git a/tests/Unit/Exceptions/Handlers/WhoopsTest.php b/tests/Unit/Exceptions/Handlers/WhoopsTest.php
index 261ee83f..4062979b 100644
--- a/tests/Unit/Exceptions/Handlers/WhoopsTest.php
+++ b/tests/Unit/Exceptions/Handlers/WhoopsTest.php
@@ -74,6 +74,14 @@ class WhoopsTest extends TestCase
);
$whoopsRunner
->expects($this->once())
+ ->method('writeToOutput')
+ ->with(false);
+ $whoopsRunner
+ ->expects($this->once())
+ ->method('allowQuit')
+ ->with(false);
+ $whoopsRunner
+ ->expects($this->once())
->method('handleException')
->with($exception);