/** * Test for method getProductPrice * * @covers \Magento\Catalog\Block\Product\AbstractProduct::getProductPriceHtml * @covers \Magento\Catalog\Block\Product\AbstractProduct::getProductPrice */ public function testGetProductPrice() { $expectedPriceHtml = '<html>Expected Price html with price $30</html>'; $priceRenderBlock = $this->getMock('Magento\\Framework\\Pricing\\Render', ['render'], [], '', false); $product = $this->getMock('Magento\\Catalog\\Model\\Product', [], [], '', false); $this->layoutMock->expects($this->once())->method('getBlock')->with('product.price.render.default')->will($this->returnValue($priceRenderBlock)); $priceRenderBlock->expects($this->once())->method('render')->will($this->returnValue($expectedPriceHtml)); $this->assertEquals($expectedPriceHtml, $this->block->getProductPrice($product)); }
/** * {@inheritdoc} */ public function getProductPrice(\Magento\Catalog\Model\Product $product) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getProductPrice'); if (!$pluginInfo) { return parent::getProductPrice($product); } else { return $this->___callPlugins('getProductPrice', func_get_args(), $pluginInfo); } }