本文整理匯總了PHP中Zend\Paginator\Paginator::factory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Paginator::factory方法的具體用法?PHP Paginator::factory怎麽用?PHP Paginator::factory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Paginator\Paginator
的用法示例。
在下文中一共展示了Paginator::factory方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();
$this->_scrollingStyle = new \Zend\Paginator\ScrollingStyle\All();
$this->_paginator = \Zend\Paginator\Paginator::factory(range(1, 101));
$this->_paginator->setItemCountPerPage(10);
}
示例2: testDoesNotThrowOutOfBoundsExceptionIfIteratorIsEmpty
/**
* @group ZF-4151
*/
public function testDoesNotThrowOutOfBoundsExceptionIfIteratorIsEmpty()
{
$this->_paginator = \Zend\Paginator\Paginator::factory(new \ArrayIterator(array()));
$items = $this->_paginator->getCurrentItems();
foreach ($items as $item) {
}
}
示例3: setUp
/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();
$this->_scrollingStyle = new \Zend\Paginator\ScrollingStyle\Jumping();
$this->_paginator = \Zend\Paginator\Paginator::factory(range(1, 101));
$this->_paginator->setItemCountPerPage(10);
$this->_paginator->setPageRange(10);
$this->_expectedRange = array_combine(range(1, 10), range(1, 10));
}
示例4: testAdapterReturnsCorrectValues
/**
* @group ZF-3873
*/
public function testAdapterReturnsCorrectValues()
{
$paginator = Paginator\Paginator::factory(2);
$paginator->setCurrentPageNumber(1);
$paginator->setItemCountPerPage(5);
$pages = $paginator->getPages();
$this->assertEquals(2, $pages->currentItemCount);
$this->assertEquals(2, $pages->lastItemNumber);
$paginator = Paginator\Paginator::factory(19);
$paginator->setCurrentPageNumber(4);
$paginator->setItemCountPerPage(5);
$pages = $paginator->getPages();
$this->assertEquals(4, $pages->currentItemCount);
$this->assertEquals(19, $pages->lastItemNumber);
}
示例5: testUsesPaginatorFromViewOnlyIfNoneSupplied
/**
* @group ZF-4328
*/
public function testUsesPaginatorFromViewOnlyIfNoneSupplied()
{
$this->_viewHelper->getView()->vars()->paginator = $this->_paginator;
$paginator = Paginator\Paginator::factory(range(1, 30));
Helper\PaginationControl::setDefaultViewPartial('testPagination.phtml');
$output = $this->_viewHelper->__invoke($paginator);
$this->assertContains('page count (3)', $output, $output);
}
示例6: testArrayAccessInClassSerializableLimitIterator
/**
* @group ZF-9396
*/
public function testArrayAccessInClassSerializableLimitIterator()
{
$iterator = new \ArrayIterator(array('zf9396', 'foo', null));
$paginator = Paginator\Paginator::factory($iterator);
$this->assertEquals('zf9396', $paginator->getItem(1));
$items = $paginator->getAdapter()->getItems(0, 10);
$this->assertEquals('foo', $items[1]);
$this->assertEquals(0, $items->key());
$this->assertFalse(isset($items[2]));
$this->assertTrue(isset($items[1]));
$this->assertFalse(isset($items[3]));
}
示例7: testDoesNotThrowOutOfBoundsExceptionIfIteratorIsEmpty
/**
* @group ZF-4151
*/
public function testDoesNotThrowOutOfBoundsExceptionIfIteratorIsEmpty()
{
$this->_paginator = \Zend\Paginator\Paginator::factory(new \ArrayIterator(array()));
$items = $this->_paginator->getCurrentItems();
try {
foreach ($items as $item) {
}
} catch (\OutOfBoundsException $e) {
$this->fail('Empty iterator caused in an OutOfBoundsException');
}
}
示例8: testAcceptAndHandlePaginatorAdapterAggregateDataInFactory
/**
* @group ZF-7602
*/
public function testAcceptAndHandlePaginatorAdapterAggregateDataInFactory()
{
$p = Paginator\Paginator::factory(new TestArrayAggregate());
$this->assertEquals(1, count($p));
$this->assertType('Zend\\Paginator\\Adapter\\ArrayAdapter', $p->getAdapter());
$this->assertEquals(4, count($p->getAdapter()));
}