Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function render(Pagination $pagination, array $parameters = array(), $template = null)
 {
     if (1 >= $pagination->getPageCount()) {
         return '';
     }
     if (null === $template) {
         $template = $this->template;
     }
     $parameters['pagination'] = $pagination;
     if (false === isset($parameters['max_near_pages'])) {
         $parameters['max_near_pages'] = $this->maxNearPages;
     }
     return $this->twig->render($template, $parameters);
 }
Exemplo n.º 2
0
 public function testPagination_WithNegativeCurrentPage()
 {
     $pagination = new Pagination(-2, 2, 0);
     $this->assertEquals(1, $pagination->getCurrentPage());
     $this->assertEquals(0, $pagination->getOffset());
 }