public function testPaginationWithLaravelAdapter() { $records = Capsule::table('sample'); $expected = Capsule::table('sample')->limit(20)->offset(60)->get(); $paginatorClass = new Paginator(); $paginator = $paginatorClass->page(4)->perPage(20)->make($records); $this->assertEquals(100, $paginator->total(), 'Failed asserting pagination total.'); $this->assertEquals($expected, $paginator->records(), 'Failed asserting pagination records.'); }
public function testPaginatorGenerateWithPixieAdapter() { $records = $this->qb->table('sample')->select('t_value'); $expected = $this->qb->table('sample')->select('t_value')->limit(10)->offset(10)->get(); $paginatorClass = new Paginator(); $paginator = $paginatorClass->page(2)->perPage(10)->make($records); $this->assertEquals(100, $paginator->total(), 'Failed asserting pagination total.'); $this->assertEquals($expected, $paginator->records(), 'Failed asserting pagination records.'); }
public function testPaginationWithDoctrineDbalAdapter() { $cqb = clone $this->qb; $records = $this->qb->select('*')->from('sample', 'sample'); $cqb->select('*')->from('sample', 'sample')->setMaxResults(20)->setFirstResult(60); $expected = $cqb->execute()->fetchAll(); /*var_dump($this->qb->execute()->fetchAll()); exit;*/ $paginatorClass = new Paginator(); $paginator = $paginatorClass->page(4)->perPage(20)->make($records); $this->assertEquals(90, $paginator->total(), 'Failed asserting pagination total.'); $this->assertEquals($expected, $paginator->records(), 'Failed asserting pagination records.'); }