示例#1
0
 public function testGetHtmlBoth()
 {
     $arguments = [];
     $this->model->setZone(\Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW);
     $amountRender = $this->getMock('Magento\\Framework\\Pricing\\Render\\Amount', ['setPriceDisplayLabel', 'setPriceWrapperCss', 'setPriceId', 'getSaleableItem'], [], '', false);
     $product = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\SaleableInterface');
     $product->expects($this->once())->method('getId');
     $this->taxHelperMock->expects($this->once())->method('displayBothPrices')->will($this->returnValue(true));
     $amountRender->expects($this->once())->method('setPriceDisplayLabel');
     $amountRender->expects($this->once())->method('getSaleableItem')->will($this->returnValue($product));
     $amountRender->expects($this->once())->method('setPriceId');
     $amountRender->expects($this->once())->method('setPriceWrapperCss');
     $this->model->render($amountRender, $arguments);
 }
示例#2
0
 public function testGetHtmlBoth()
 {
     $arguments = [];
     $totalDisplayValue = 10.0;
     $taxAdjustment = 2.0;
     $displayValue = 8.0;
     $this->model->setZone(\Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW);
     $amountRender = $this->getMock('Magento\\Framework\\Pricing\\Render\\Amount', ['setPriceDisplayLabel', 'setPriceId', 'getSaleableItem', 'getDisplayValue', 'getAmount', 'setDisplayValue'], [], '', false);
     $amountMock = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\Amount\\AmountInterface');
     $amountMock->expects($this->once())->method('getAdjustmentAmount')->with(\Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE)->will($this->returnValue($taxAdjustment));
     $product = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\Object\\SaleableInterface');
     $product->expects($this->once())->method('getId');
     $this->taxHelperMock->expects($this->once())->method('displayBothPrices')->will($this->returnValue(true));
     $amountRender->expects($this->at(0))->method('setPriceDisplayLabel');
     $amountRender->expects($this->at(1))->method('getSaleableItem')->will($this->returnValue($product));
     $amountRender->expects($this->at(2))->method('setPriceId');
     $amountRender->expects($this->at(3))->method('getDisplayValue')->will($this->returnValue($totalDisplayValue));
     $amountRender->expects($this->at(4))->method('getAmount')->will($this->returnValue($amountMock));
     $amountRender->expects($this->at(5))->method('setDisplayValue')->with($displayValue);
     $this->model->render($amountRender, $arguments);
 }