/** * Enable suppressing of errors. */ public function enable() { // suppress all errors $this->errorHandler->addErrorHandler(function () { return true; }); $this->errorHandler->addExceptionHandler(function (Exception $ex) { return true; }); }
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); }
/** * Enable error handling. */ public function enableErrorHandling() { $this->errorHandler->addErrorHandler([$this, 'handleError']); }
function it_enables_error_handling(IErrorHandler $errorHandler) { $errorHandler->addErrorHandler([$this, 'handleError'])->shouldBeCalled(); $this->enableErrorHandling(); }
function it_enables_error_handling(IErrorHandler $errorHandler) { $errorHandler->addErrorHandler(Argument::type('callable'))->shouldBeCalled(); $errorHandler->addExceptionHandler(Argument::type('callable'))->shouldBeCalled(); $this->enable(); }