public function testException()
 {
     $e = new Exception();
     $this->errorDispatcher->expects($this->once())->method('dispatchException')->with($this->equalTo($e));
     $handler = $this->initLogger();
     $handler->log(\Psr\Log\LogLevel::ERROR, sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), array('exception' => $e));
 }
Ejemplo n.º 2
0
 public function testException()
 {
     $exception = new Exception();
     $this->errorDispatcher->expects($this->once())->method('dispatchException')->with($this->equalTo($exception));
     $errorHandler = ErrorHandler::register($this->initLogger(), false, false);
     $errorHandler->registerExceptionHandler(null, false);
     $errorHandler->handleException($exception);
 }
Ejemplo n.º 3
0
 public function testDispatchExceptionWithDisabledIgnoreRepeatedSource()
 {
     $this->dispatcher->ignoreRepeatedSource = false;
     $this->connector->expects($this->exactly(2))->method('sendMessage');
     $exception = new \Exception();
     $this->dispatcher->dispatchException($exception);
     $this->dispatcher->dispatchException($exception);
 }
 public function testError($classesPartialsTraceIgnore = null)
 {
     $code = E_USER_NOTICE;
     $message = 'message';
     $file = __FILE__;
     $line = __LINE__;
     $this->errorDispatcher->expects($this->once())->method('dispatchError')->with($this->equalTo($code), $this->equalTo($message), $this->equalTo($file), $this->equalTo($line), $classesPartialsTraceIgnore ?: $this->equalTo($this->getHandlerDefaultOption('classesPartialsTraceIgnore')));
     $errorHandler = ErrorHandler::register($this->initLogger($classesPartialsTraceIgnore ? array('classesPartialsTraceIgnore' => $classesPartialsTraceIgnore) : array()), false);
     $errorHandler->registerErrorHandler(array(), false, E_USER_WARNING);
     $errorHandler->handleError($code, $message, $file, $line);
 }