Ejemplo n.º 1
0
 public function test_on_page_scope()
 {
     $paginated = Factory::make(new Category(), ['page_rows' => 3, 'page_columns' => 4]);
     $query = Product::onPage($paginated, 1)->getQuery();
     $this->assertEquals(0, $query->offset);
     $this->assertEquals(12, $query->limit);
     $query = Product::onPage($paginated, 2)->getQuery();
     $this->assertEquals(12, $query->offset);
     $infinite = Factory::make(new Category(), ['page_rows' => 0, 'page_columns' => 4]);
     $query = Product::onPage($infinite, 1)->getQuery();
     $this->assertEquals(0, $query->offset);
     $this->assertEquals(0, $query->limit);
 }