/** * @param int $page * @return \Symfony\Component\HttpFoundation\Response */ public function listAction($page) { $pagerfanta = new Pagerfanta($this->galleryManager->createPagerfantaAdapter()); $pagerfanta->setMaxPerPage($this->galleriesPerPage); $pagerfanta->setCurrentPage($page); return $this->templating->renderResponse('FSiGalleryBundle:Gallery:list.html.twig', array('galleries' => $pagerfanta, 'preview_photos_count' => $this->previewPhotosCount)); }
function it_render_template_with_paginator(EngineInterface $templating, Response $response, GalleryManagerInterface $galleryManager, AdapterInterface $adapter) { $galleryManager->createPagerfantaAdapter()->willReturn($adapter); $adapter->getNbResults()->willReturn(5); $templating->renderResponse('FSiGalleryBundle:Gallery:list.html.twig', Argument::allOf(Argument::withEntry('galleries', Argument::type('Pagerfanta\\Pagerfanta')), Argument::withEntry('preview_photos_count', 4)))->willReturn($response); $this->listAction(2)->shouldReturn($response); }