/** * @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(); }
/** * {@inheritdoc} */ public function setProductsCount($count) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setProductsCount'); if (!$pluginInfo) { return parent::setProductsCount($count); } else { return $this->___callPlugins('setProductsCount', func_get_args(), $pluginInfo); } }