public function ErrorHandlerTest::testHandleFatalError in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/debug/Tests/ErrorHandlerTest.php \Symfony\Component\Debug\Tests\ErrorHandlerTest::testHandleFatalError()
File
- vendor/
symfony/ debug/ Tests/ ErrorHandlerTest.php, line 375
Class
- ErrorHandlerTest
- ErrorHandlerTest.
Namespace
Symfony\Component\Debug\TestsCode
public function testHandleFatalError() {
try {
$handler = ErrorHandler::register();
$error = array(
'type' => E_PARSE,
'message' => 'foo',
'file' => 'bar',
'line' => 123,
);
$logger = $this
->getMock('Psr\\Log\\LoggerInterface');
$that = $this;
$logArgCheck = function ($level, $message, $context) use ($that) {
$that
->assertEquals('Fatal Parse Error: foo', $message);
$that
->assertArrayHasKey('type', $context);
$that
->assertEquals($context['type'], E_PARSE);
};
$logger
->expects($this
->once())
->method('log')
->will($this
->returnCallback($logArgCheck));
$handler
->setDefaultLogger($logger, E_PARSE);
$handler
->handleFatalError($error);
restore_error_handler();
restore_exception_handler();
} catch (\Exception $e) {
restore_error_handler();
restore_exception_handler();
throw $e;
}
}