示例#1
0
 public function __invoke(Paginator\Paginator $paginator = null, $scrollingStyle = null, $partial = null, $params = null)
 {
     if (is_string($params)) {
         $params = (array) $params;
     }
     if (isset($params['size'])) {
         if ($params['size'] != 'sm' && $params['size'] != 'lg') {
             throw new \RuntimeException('Size parameter must be either "sm" or "lg"');
         }
     }
     if ($partial === null && isset($params['type'])) {
         if ($params['type'] == 'pager') {
             $partial = 'paginator/pager.phtml';
         }
     }
     if (!isset($params['aligned']) || !is_bool($params['aligned'])) {
         $params['aligned'] = true;
     }
     if (!isset($params['nextLabel'])) {
         $params['nextLabel'] = self::$nextLabel;
     }
     if (!isset($params['previousLabel'])) {
         $params['previousLabel'] = self::$previousLabel;
     }
     return parent::__invoke($paginator, $scrollingStyle, $partial, $params);
 }
    /**
     * @group ZF-4878
     */
    public function testCanUseObjectForScrollingStyle()
    {
        $all = new Paginator\ScrollingStyle\All();

        $output = $this->_viewHelper->__invoke($this->_paginator, $all, 'testPagination.phtml');

        $this->assertContains('page count (11) equals pages in range (11)', $output, $output);
    }
    /**
     * @group ZF-4878
     */
    public function testCanUseObjectForScrollingStyle()
    {
        $all = new Paginator\ScrollingStyle\All();

        try {
            $output = $this->_viewHelper->__invoke($this->_paginator, $all, 'testPagination.phtml');
        } catch (\Exception $e) {
            $this->fail('Could not use object for sliding style');
        }

        $this->assertContains('page count (11) equals pages in range (11)', $output, $output);
    }