Ejemplo n.º 1
0
 public function testPages()
 {
     $list = new PaginatedList(new ArrayList());
     $list->setPageLength(10);
     $list->setTotalItems(50);
     $this->assertEquals(5, count($list->Pages()));
     $this->assertEquals(3, count($list->Pages(3)));
     $this->assertEquals(5, count($list->Pages(15)));
     $list->setCurrentPage(3);
     $expectAll = array(array('PageNum' => 1), array('PageNum' => 2), array('PageNum' => 3, 'CurrentBool' => true), array('PageNum' => 4), array('PageNum' => 5));
     $this->assertDOSEquals($expectAll, $list->Pages());
     $expectLimited = array(array('PageNum' => 2), array('PageNum' => 3, 'CurrentBool' => true), array('PageNum' => 4));
     $this->assertDOSEquals($expectLimited, $list->Pages(3));
 }