public function testGetProductPrice() { //Data $expectedResult = 'html'; $blockName = 'product.price.render.default'; $productId = 1; //Verification $product = $this->getMock('Magento\\Catalog\\Model\\Product', ['getId', '__wakeup'], [], '', false); $product->expects($this->once())->method('getId')->will($this->returnValue($productId)); $blockMock = $this->getMock('Magento\\Framework\\Pricing\\Render', ['render'], [], '', false); $blockMock->expects($this->once())->method('render')->with('final_price', $product, ['price_id' => 'product-price-' . $productId . '-compare-list-top', 'display_minimal_price' => true, 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST])->will($this->returnValue($expectedResult)); $this->layout->expects($this->once())->method('getBlock')->with($blockName)->will($this->returnValue($blockMock)); $this->assertEquals($expectedResult, $this->block->getProductPrice($product, '-compare-list-top')); }
/** * {@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); } }