$this->
assertEquals(new Response('foo'
),
$event->
getResponse());
try { $l->
logKernelException($event2);
$l->
onKernelException($event2);
$this->
fail('RuntimeException expected'
);
} catch (\RuntimeException
$e) { $this->
assertSame('bar',
$e->
getMessage());
$this->
assertSame('foo',
$e->
getPrevious()->
getMessage());
} $this->
assertEquals(3,
$logger->
countErrors());
$logs =
$logger->
getLogs('critical'
);
$this->
assertCount(3,
$logs);
$this->
assertStringStartsWith('Uncaught PHP Exception Exception: "foo" at ErrorListenerTest.php line',
$logs[0
]);
$this->
assertStringStartsWith('Uncaught PHP Exception Exception: "foo" at ErrorListenerTest.php line',
$logs[1
]);
$this->
assertStringStartsWith('Exception thrown when handling an exception (RuntimeException: bar at ErrorListenerTest.php line',
$logs[2
]);
} public function testHandleWithLoggerAndCustomConfiguration() { $request =
new Request();
$event =
new ExceptionEvent(new TestKernel(),
$request, HttpKernelInterface::MAIN_REQUEST,
new \
RuntimeException('bar'
));