Example #1
0
 /**
  * @param string $displayType
  * @param bool $pagerEnable
  * @param int $productsCount
  * @param int $productsPerPage
  */
 protected function startTestGetProductCollection($displayType, $pagerEnable, $productsCount, $productsPerPage)
 {
     $productCollectionFactory = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\CollectionFactory', ['create'], [], '', false, false);
     $productCollectionFactory->expects($this->atLeastOnce())->method('create')->willReturn($this->productCollection);
     $this->block = $this->objectManager->getObject('Magento\\Catalog\\Block\\Product\\Widget\\NewWidget', ['context' => $this->context, 'productCollectionFactory' => $productCollectionFactory]);
     if (null === $productsPerPage) {
         $this->block->unsetData('products_per_page');
     } else {
         $this->block->setData('products_per_page', $productsPerPage);
     }
     $this->block->setData('show_pager', $pagerEnable);
     $this->block->setData('display_type', $displayType);
     $this->block->setProductsCount($productsCount);
     $this->block->toHtml();
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function toHtml()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'toHtml');
     if (!$pluginInfo) {
         return parent::toHtml();
     } else {
         return $this->___callPlugins('toHtml', func_get_args(), $pluginInfo);
     }
 }