/** * Tests converting the derived PageNotFoundException exception. */ public function testConvertDerivedPageNotFoundException() { $event = new GetResponseForExceptionEvent($this->mockKernel(), new Request(), HttpKernelInterface::MASTER_REQUEST, new DerivedPageNotFoundException()); $listener = new ExceptionConverterListener(); $listener->onKernelException($event); $exception = $event->getException(); $this->assertInstanceOf('Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException', $exception); $this->assertInstanceOf('Contao\\CoreBundle\\Exception\\PageNotFoundException', $exception->getPrevious()); }
/** * Tests converting an unknown exception. */ public function testConvertUnknownException() { $event = new GetResponseForExceptionEvent($this->mockKernel(), new Request(), HttpKernelInterface::MASTER_REQUEST, new \RuntimeException()); $listener = new ExceptionConverterListener(); $listener->onKernelException($event); $exception = $event->getException(); $this->assertInstanceOf('RuntimeException', $exception); }