public function testGetGalleriesAction() { $gManager = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryManagerInterface'); $gallery = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryInterface'); $gManager->expects($this->once())->method('findBy')->will($this->returnValue(array($gallery))); $gController = new GalleryController($gManager); $params = $this->getMock('FOS\\RestBundle\\Request\\ParamFetcherInterface'); $params->expects($this->once())->method('all')->will($this->returnValue(array('page' => 1, 'count' => 10, 'orderBy' => array('id' => "ASC")))); $params->expects($this->exactly(3))->method('get'); $this->assertEquals(array($gallery), $gController->getGalleriesAction($params)); }
public function testGetGalleriesAction() { $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('getPager')->will($this->returnValue(array())); $gController = new GalleryController($gManager, $mediaManager, $formFactory, 'test'); $params = $this->getMock('FOS\\RestBundle\\Request\\ParamFetcherInterface'); $params->expects($this->once())->method('all')->will($this->returnValue(array('page' => 1, 'count' => 10, 'orderBy' => array('id' => 'ASC')))); $params->expects($this->exactly(3))->method('get'); $this->assertEquals(array(), $gController->getGalleriesAction($params)); }