/** * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * @expectedExceptionMessage Gallery (42) not found */ public function testGetGalleryNotFoundAction() { $gManager = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryManagerInterface'); $gManager->expects($this->once())->method('findOneBy'); $gController = new GalleryController($gManager); $gController->getGalleryAction(42); }
/** * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * @expectedExceptionMessage Gallery (42) not found */ public function testGetGalleryNotFoundAction() { $gManager = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryManagerInterface'); $mediaManager = $this->getMock('Sonata\\MediaBundle\\Model\\MediaManagerInterface'); $formFactory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface'); $gManager->expects($this->once())->method('findOneBy'); $gController = new GalleryController($gManager, $mediaManager, $formFactory, 'test'); $gController->getGalleryAction(42); }