eZ\Bundle\EzPublishCoreBundle\Tests\EventListener\ExceptionListenerTest::testOtherRepositoryException PHP Method

testOtherRepositoryException() public method

public testOtherRepositoryException ( Exception $exception )
$exception Exception
    public function testOtherRepositoryException(Exception $exception)
    {
        $messageTemplate = 'some message template';
        $translationParams = ['some' => 'thing'];
        $exception->setMessageTemplate($messageTemplate);
        $exception->setParameters($translationParams);
        $event = $this->generateExceptionEvent($exception);
        $translatedMessage = 'translated message';
        $this->translator->expects($this->once())->method('trans')->with($messageTemplate, $translationParams)->willReturn($translatedMessage);
        $this->listener->onKernelException($event);
        $convertedException = $event->getException();
        self::assertInstanceOf('\\Symfony\\Component\\HttpKernel\\Exception\\HttpException', $convertedException);
        self::assertSame($exception, $convertedException->getPrevious());
        self::assertSame(get_class($exception) . ': ' . $translatedMessage, $convertedException->getMessage());
        self::assertSame(Response::HTTP_INTERNAL_SERVER_ERROR, $convertedException->getStatusCode());
    }