public function testOnConsoleError() { $error =
new \
TypeError('An error occurred'
);
$logger =
$this->
createMock(LoggerInterface::
class);
$logger ->
expects($this->
once()) ->
method('critical'
) ->
with('Error thrown while running command "{command}". Message: "{message}"',
['exception' =>
$error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred'
]) ;
$listener =
new ErrorListener($logger);
$listener->
onConsoleError(new ConsoleErrorEvent(new ArgvInput(['console.php', 'test:run', '--foo=baz', 'buzz'
]),
$this->
createMock(OutputInterface::
class),
$error,
new Command('test:run'
)));
} public function testOnConsoleErrorWithNoCommandAndNoInputString() { $error =
new \
RuntimeException('An error occurred'
);
$logger =
$this->
createMock(LoggerInterface::
class);
$logger ->
expects($this->
once()) ->
method('critical'
)