public function testNotFoundException() { $messageTemplate = 'some message template'; $translationParams = ['some' => 'thing']; $exception = new NotFoundException('foo', 'bar'); $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\\NotFoundHttpException', $convertedException); self::assertSame($exception, $convertedException->getPrevious()); self::assertSame($translatedMessage, $convertedException->getMessage()); }