本文整理汇总了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()));
}