function it_initializes(IHttpApp $httpApp, IErrorHandler $errorHandler, IContainer $container)
 {
     $httpApp->getDebug()->willReturn(true);
     $errorHandler->addErrorHandler(Argument::any())->shouldBeCalled();
     $errorHandler->addExceptionHandler(Argument::any())->shouldBeCalled();
     $container->set(JsonErrorHandler::class, Argument::type(JsonErrorHandler::class))->shouldBeCalled();
     $this->initialize($httpApp, $errorHandler, $container);
 }
コード例 #2
0
 /**
  * Enable suppressing of errors.
  */
 public function enable()
 {
     // suppress all errors
     $this->errorHandler->addErrorHandler(function () {
         return true;
     });
     $this->errorHandler->addExceptionHandler(function (Exception $ex) {
         return true;
     });
 }
コード例 #3
0
ファイル: ErrorConverter.php プロジェクト: weew/error-handler
 /**
  * @param IErrorHandler $handler
  * @param IError $error
  *
  * @return bool
  */
 public function convertErrorToExceptionAndCallHandler(IErrorHandler $handler, IError $error)
 {
     return $handler->handleException(ErrorType::createExceptionForError($error));
     return true;
 }
コード例 #4
0
 /**
  * Enable exception handling.
  */
 public function enableExceptionHandling()
 {
     $this->errorHandler->addExceptionHandler([$this, 'handleException']);
 }
コード例 #5
0
 function it_enables_exception_handling(IErrorHandler $errorHandler)
 {
     $errorHandler->addExceptionHandler([$this, 'handleException'])->shouldBeCalled();
     $this->enableExceptionHandling();
 }
コード例 #6
0
 function it_enables_error_handling(IErrorHandler $errorHandler)
 {
     $errorHandler->addErrorHandler(Argument::type('callable'))->shouldBeCalled();
     $errorHandler->addExceptionHandler(Argument::type('callable'))->shouldBeCalled();
     $this->enable();
 }