Beispiel #1
0
 public function testGetBaseTotalAmount()
 {
     $baseRowTotal = 100;
     $baseTaxAmount = 10;
     $baseDiscountTaxCompensationAmount = 2;
     $baseDiscountAmount = 20;
     $baseWeeeAmount = 5;
     $expectedValue = $baseRowTotal + $baseTaxAmount + $baseDiscountTaxCompensationAmount - $baseDiscountAmount + $baseWeeeAmount;
     $itemMock = $this->getMockBuilder('\\Magento\\Sales\\Model\\Order\\Item')->disableOriginalConstructor()->setMethods(['getBaseRowTotal', 'getBaseTaxAmount', 'getBaseDiscountTaxCompensationAmount', '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('getBaseDiscountTaxCompensationAmount')->will($this->returnValue($baseDiscountTaxCompensationAmount));
     $itemMock->expects($this->once())->method('getBaseDiscountAmount')->will($this->returnValue($baseDiscountAmount));
     $this->weeeHelper->expects($this->once())->method('getBaseRowWeeeTaxInclTax')->with($itemMock)->will($this->returnValue($baseWeeeAmount));
     $this->assertEquals($expectedValue, $this->renderer->getBaseTotalAmount($itemMock));
 }
Beispiel #2
0
 /**
  * Calculate base total amount for the item
  *
  * @param Item|QuoteItem|InvoiceItem|CreditmemoItem $item
  * @return mixed
  */
 public function getBaseTotalAmount($item)
 {
     return $this->itemPriceRenderer->getBaseTotalAmount($item);
 }