当前位置: 首页>>代码示例>>PHP>>正文


PHP Paginator::factory方法代码示例

本文整理汇总了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);
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:10,代码来源:AllTest.php

示例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) {
     }
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:10,代码来源:IteratorTest.php

示例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));
 }
开发者ID:rexmac,项目名称:zf2,代码行数:12,代码来源:JumpingTest.php

示例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);
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:18,代码来源:NullTest.php

示例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);
    }
开发者ID:niallmccrudden,项目名称:zf2,代码行数:12,代码来源:PaginationControlTest.php

示例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]));
 }
开发者ID:Rovak,项目名称:zf2,代码行数:15,代码来源:PaginatorTest.php

示例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');
     }
 }
开发者ID:rexmac,项目名称:zf2,代码行数:14,代码来源:IteratorTest.php

示例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()));
 }
开发者ID:stunti,项目名称:zf2,代码行数:10,代码来源:PaginatorTest.php


注:本文中的Zend\Paginator\Paginator::factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。