/** * Test if exception handler is actually executed * Setting the exception handler from outside is tested in LoggerTest::testExternalExceptionHandler() * @see LoggerTest::testExternalExceptionHandler() */ public function testExternalExceptionHandler() { $exHandler = function (\Exception $ex) { $e = array(); $e['message'] = $ex->getMessage(); $e['exceptionHandler'] = __METHOD__; return $e; }; $logEvent = LogEvent::create(ILogger::LEVEL_FATAL, new \Exception('Hallo'), array(), 'PHPUnit', $exHandler); $this->arrayHasKey('message', $logEvent['exception']); $this->arrayHasKey('exceptionHandler', $logEvent['exception']); $this->assertEquals($logEvent['exception']['message'], 'Hallo'); $this->assertStringEndsWith('{closure}', $logEvent['exception']['exceptionHandler']); }