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)); }
/** * Calculate base total amount for the item * * @param Item|QuoteItem|InvoiceItem|CreditmemoItem $item * @return mixed */ public function getBaseTotalAmount($item) { return $this->itemPriceRenderer->getBaseTotalAmount($item); }