Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

use default console exception template instead of empty string #5

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Service/ConsoleExceptionStrategyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ private function injectDisplayExceptions(ExceptionStrategy $strategy, array $con
*/
private function injectExceptionMessage(ExceptionStrategy $strategy, array $config)
{
$message = isset($config['exception_message']) ? $config['exception_message'] : '';
$strategy->setMessage($message);
if (isset($config['exception_message'])) {
$strategy->setMessage($config['exception_message']);
}
}
}
5 changes: 3 additions & 2 deletions test/Service/ConsoleExceptionStrategyFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ public function testEnablesDisplayExceptionsWithoutConfiguration()
$this->assertTrue($strategy->displayExceptions());
}

public function testProvidesEmptyExceptionMessageWithoutConfiguration()
public function testProvidesDefaultExceptionMessageWithoutConfiguration()
{
$this->container->has('config')->willReturn(false);

$strategy = $this->factory->__invoke($this->container->reveal(), ExceptionStrategy::class);
$this->assertInstanceOf(ExceptionStrategy::class, $strategy);
$this->assertEquals('', $strategy->getMessage());
$plainStrategy = new ExceptionStrategy();
$this->assertEquals($plainStrategy->getMessage(), $strategy->getMessage());
}

public function overrideDisplayExceptionsConfiguration()
Expand Down