當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。