public function __construct(DibiDataSource $datasource, $itemsPerPage = 20) { $this->datasource = $datasource; $this->itemsPerPage = $itemsPerPage; $this->getPaginator(); parse_str($_SERVER['QUERY_STRING'], $vars); if (isset($vars[$this->var_name])) { $this->paginator->setPage($vars[$this->var_name]); } unset($vars[$this->var_name]); $this->url = $_SERVER['SCRIPT_NAME'] . '?' . http_build_query($vars); $this->paginator->setItemsPerPage($this->itemsPerPage); $this->paginator->setItemCount(count($this->datasource)); }
/** * @covers Hermes\Resource\Paginator::getNextPage */ public function testGetNextPage() { $this->object->setPage(1); $this->assertSame(2, $this->object->getNextPage()); }