public function testGetProductPriceHtml()
 {
     $id = 6;
     $expectedHtml = '
     <div class="price-box price-final_price">
         <span class="regular-price" id="product-price-' . $id . '">
             <span class="price">$0.00</span>
         </span>
     </div>';
     $type = 'widget-new-list';
     $productMock = $this->getMock('Magento\\Catalog\\Model\\Product', ['getId'], [], '', false, false);
     $productMock->expects($this->once())->method('getId')->willReturn($id);
     $arguments = ['price_id' => 'old-price-' . $id . '-' . $type, 'display_minimal_price' => true, 'include_container' => true, 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST];
     $priceBoxMock = $this->getMock('Magento\\Framework\\Pricing\\Render', ['render'], [], '', false, false);
     $this->layout->expects($this->once())->method('getBlock')->with($this->equalTo('product.price.render.default'))->willReturn($priceBoxMock);
     $priceBoxMock->expects($this->once())->method('render')->with($this->equalTo('final_price'), $this->equalTo($productMock), $this->equalTo($arguments))->willReturn($expectedHtml);
     $result = $this->block->getProductPriceHtml($productMock, $type);
     $this->assertEquals($expectedHtml, $result);
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function getProductPriceHtml(\Magento\Catalog\Model\Product $product, $priceType = null, $renderZone = 'item_list', array $arguments = array())
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getProductPriceHtml');
     if (!$pluginInfo) {
         return parent::getProductPriceHtml($product, $priceType, $renderZone, $arguments);
     } else {
         return $this->___callPlugins('getProductPriceHtml', func_get_args(), $pluginInfo);
     }
 }