/** * {@inheritdoc} */ public function getImage($product, $imageId, $attributes = array()) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getImage'); if (!$pluginInfo) { return parent::getImage($product, $imageId, $attributes); } else { return $this->___callPlugins('getImage', func_get_args(), $pluginInfo); } }
public function testToHtml() { $this->assertEmpty($this->_block->getProductCollection()); $this->_block->setProductsCount(5); $this->_block->setTemplate('product/widget/new/content/new_list.phtml'); $this->_block->setLayout(\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\LayoutInterface')); $html = $this->_block->toHtml(); $this->assertNotEmpty($html); $this->assertContains('New Product', $html); $this->assertInstanceOf('Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection', $this->_block->getProductCollection()); }
/** * Retrieve how many products should be displayed * * @return int */ public function getProductsCount() { if (!$this->hasData('products_count')) { return parent::getProductsCount(); } return $this->getData('products_count'); }