Example #1
0
 private function setErrorHanlder()
 {
     $this->diManager->createErrorHandler();
     $errorHandler = $this->diManager->getDI()->get('errorHandler');
     if (!$errorHandler instanceof Exception\HandlerInterface) {
         throw new \RuntimeException(sprintf('%s is invalid', get_class($errorHandler)));
     }
     set_error_handler([$errorHandler, 'errorHandler']);
     set_exception_handler([$errorHandler, 'exceptionHandler']);
 }
Example #2
0
 public function testCreateErrorHandlerSuccess()
 {
     $config = ['error_handler' => ['options' => ['views_dir' => __DIR__ . '/../view/error', 'template_500' => 'error.phtml', 'template_404' => 'not-found.phtml']]];
     $diMock = $this->getMock(Di::class, ['get', 'set'], [[]]);
     $diMock->expects($this->once())->method('get')->with('config')->will($this->returnValue(new Config($config)));
     $diMock->expects($this->once())->method('set');
     $di = new DiManager($diMock);
     $di->createErrorHandler();
 }