Skip to content

Commit c9240bf

Browse files
committed
Fix risky test
We need to mock out the LoggerInterface's error call so that it doesn't call error_log() behind the scenes on us as this will output a new line character and cause a risky test notice.
1 parent f0f5800 commit c9240bf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/Handlers/ErrorHandlerTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Slim\Tests\Handlers;
1212

13+
use Prophecy\Argument;
1314
use Psr\Http\Message\ResponseInterface;
1415
use Psr\Log\LoggerInterface;
1516
use ReflectionClass;
@@ -392,7 +393,16 @@ public function testLogErrorRenderer()
392393
->willReturn($renderer)
393394
->shouldBeCalledOnce();
394395

395-
$handler = new ErrorHandler($callableResolverProphecy->reveal(), $this->getResponseFactory());
396+
$loggerProphecy = $this->prophesize(LoggerInterface::class);
397+
$loggerProphecy
398+
->error(Argument::type('string'))
399+
->shouldBeCalled();
400+
401+
$handler = new ErrorHandler(
402+
$callableResolverProphecy->reveal(),
403+
$this->getResponseFactory(),
404+
$loggerProphecy->reveal()
405+
);
396406
$handler->setLogErrorRenderer('logErrorRenderer');
397407

398408
$displayErrorDetailsProperty = new ReflectionProperty($handler, 'displayErrorDetails');

0 commit comments

Comments
 (0)