/** * @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 setData($key, $value = null) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setData'); if (!$pluginInfo) { return parent::setData($key, $value); } else { return $this->___callPlugins('setData', func_get_args(), $pluginInfo); } }