コード例 #1
0
 public function testGetBaseTotalAmount()
 {
     $baseRowTotal = 100;
     $baseTaxAmount = 10;
     $baseHiddenTaxAmount = 2;
     $baseDiscountAmount = 20;
     $expectedValue = 92;
     $itemMock = $this->getMockBuilder('\\Magento\\Sales\\Model\\Order\\Item')->disableOriginalConstructor()->setMethods(['getBaseRowTotal', 'getBaseTaxAmount', 'getBaseHiddenTaxAmount', 'getBaseDiscountAmount', '__wakeup'])->getMock();
     $itemMock->expects($this->once())->method('getBaseRowTotal')->will($this->returnValue($baseRowTotal));
     $itemMock->expects($this->once())->method('getBaseTaxAmount')->will($this->returnValue($baseTaxAmount));
     $itemMock->expects($this->once())->method('getBaseHiddenTaxAmount')->will($this->returnValue($baseHiddenTaxAmount));
     $itemMock->expects($this->once())->method('getBaseDiscountAmount')->will($this->returnValue($baseDiscountAmount));
     $this->assertEquals($expectedValue, $this->renderer->getBaseTotalAmount($itemMock));
 }
コード例 #2
0
ファイル: Renderer.php プロジェクト: aiesh/magento2
 /**
  * Calculate base total amount for the item
  *
  * @param Item|QuoteItem|InvoiceItem|CreditmemoItem $item
  * @return mixed
  */
 public function getBaseTotalAmount($item)
 {
     return $this->itemPriceRenderer->getBaseTotalAmount($item);
 }