本文整理匯總了PHP中PaginatedList::getIterator方法的典型用法代碼示例。如果您正苦於以下問題:PHP PaginatedList::getIterator方法的具體用法?PHP PaginatedList::getIterator怎麽用?PHP PaginatedList::getIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PaginatedList
的用法示例。
在下文中一共展示了PaginatedList::getIterator方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetIterator
public function testGetIterator() {
$list = new PaginatedList(new ArrayList(array(
new DataObject(array('Num' => 1)),
new DataObject(array('Num' => 2)),
new DataObject(array('Num' => 3)),
new DataObject(array('Num' => 4)),
new DataObject(array('Num' => 5)),
)));
$list->setPageLength(2);
$this->assertDOSEquals(
array(array('Num' => 1), array('Num' => 2)), $list->getIterator()
);
$list->setCurrentPage(2);
$this->assertDOSEquals(
array(array('Num' => 3), array('Num' => 4)), $list->getIterator()
);
$list->setCurrentPage(3);
$this->assertDOSEquals(
array(array('Num' => 5)), $list->getIterator()
);
$list->setCurrentPage(999);
$this->assertDOSEquals(array(), $list->getIterator());
}
示例2: testLimitItems
public function testLimitItems()
{
$list = new ArrayList(range(1, 50));
$list = new PaginatedList($list);
$list->setCurrentPage(3);
$this->assertEquals(10, count($list->getIterator()->getInnerIterator()));
$list->setLimitItems(false);
$this->assertEquals(50, count($list->getIterator()->getInnerIterator()));
}