Ejemplo n.º 1
0
 public function testGetGalleryMediaAction()
 {
     $media = $this->getMock('Sonata\\MediaBundle\\Model\\MediaInterface');
     $galleryHasMedia = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryHasMediaInterface');
     $galleryHasMedia->expects($this->once())->method('getMedia')->will($this->returnValue($media));
     $gallery = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryInterface');
     $gallery->expects($this->once())->method('getGalleryHasMedias')->will($this->returnValue(array($galleryHasMedia)));
     $gManager = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryManagerInterface');
     $gManager->expects($this->once())->method('findOneBy')->will($this->returnValue($gallery));
     $gController = new GalleryController($gManager);
     $this->assertEquals(array($media), $gController->getGalleryMediasAction(1));
 }
 public function testGetGalleryMediaAction()
 {
     $media = $this->getMock('Sonata\\MediaBundle\\Model\\MediaInterface');
     $formFactory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface');
     $galleryHasMedia = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryHasMediaInterface');
     $galleryHasMedia->expects($this->once())->method('getMedia')->will($this->returnValue($media));
     $gallery = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryInterface');
     $gallery->expects($this->once())->method('getGalleryHasMedias')->will($this->returnValue(array($galleryHasMedia)));
     $gManager = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryManagerInterface');
     $gManager->expects($this->once())->method('findOneBy')->will($this->returnValue($gallery));
     $mediaManager = $this->getMock('Sonata\\MediaBundle\\Model\\MediaManagerInterface');
     $gController = new GalleryController($gManager, $mediaManager, $formFactory, 'test');
     $this->assertSame(array($media), $gController->getGalleryMediasAction(1));
 }