Esempio n. 1
0
 public function testGetPagerHtml()
 {
     $collection = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Resource\\Product\\Collection')->setMethods(['getSize'])->disableOriginalConstructor()->getMock();
     $collection->expects($this->once())->method('getSize')->willReturn(3);
     $this->productsList->setData('show_pager', true);
     $this->productsList->setData('products_per_page', 2);
     $this->productsList->setData('product_collection', $collection);
     $pagerBlock = $this->getMockBuilder('Magento\\Catalog\\Block\\Product\\Widget\\Html\\Pager')->setMethods(['toHtml', 'setUseContainer', 'setShowAmounts', 'setShowPerPage', 'setPageVarName', 'setLimit', 'setTotalLimit', 'setCollection'])->disableOriginalConstructor()->getMock();
     $pagerBlock->expects($this->once())->method('setUseContainer')->willReturnSelf();
     $pagerBlock->expects($this->once())->method('setShowAmounts')->willReturnSelf();
     $pagerBlock->expects($this->once())->method('setShowPerPage')->willReturnSelf();
     $pagerBlock->expects($this->once())->method('setPageVarName')->willReturnSelf();
     $pagerBlock->expects($this->once())->method('setLimit')->willReturnSelf();
     $pagerBlock->expects($this->once())->method('setTotalLimit')->willReturnSelf();
     $pagerBlock->expects($this->once())->method('setCollection')->with($collection)->willReturnSelf();
     $pagerBlock->expects($this->once())->method('toHtml')->willReturn('<pager_html>');
     $this->layout->expects($this->once())->method('createBlock')->willReturn($pagerBlock);
     $this->assertEquals('<pager_html>', $this->productsList->getPagerHtml());
 }
 /**
  * {@inheritdoc}
  */
 public function getPagerHtml()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getPagerHtml');
     if (!$pluginInfo) {
         return parent::getPagerHtml();
     } else {
         return $this->___callPlugins('getPagerHtml', func_get_args(), $pluginInfo);
     }
 }