示例#1
0
 public function testGetTotalAmount()
 {
     $rowTotal = 100;
     $taxAmount = 10;
     $discountTaxCompensationAmount = 2;
     $discountAmount = 20;
     $weeeAmount = 5;
     $expectedValue = 97;
     $itemMock = $this->getMockBuilder('\\Magento\\Sales\\Model\\Order\\Item')->disableOriginalConstructor()->setMethods(['getRowTotal', 'getTaxAmount', 'getDiscountTaxCompensationAmount', 'getDiscountAmount', '__wakeup'])->getMock();
     $itemMock->expects($this->once())->method('getRowTotal')->will($this->returnValue($rowTotal));
     $itemMock->expects($this->once())->method('getTaxAmount')->will($this->returnValue($taxAmount));
     $itemMock->expects($this->once())->method('getDiscountTaxCompensationAmount')->will($this->returnValue($discountTaxCompensationAmount));
     $itemMock->expects($this->once())->method('getDiscountAmount')->will($this->returnValue($discountAmount));
     $this->weeeHelper->expects($this->once())->method('getRowWeeeTaxInclTax')->with($itemMock)->will($this->returnValue($weeeAmount));
     $this->assertEquals($expectedValue, $this->renderer->getTotalAmount($itemMock));
 }
示例#2
0
 /**
  * Calculate total amount for the item
  *
  * @param Item|QuoteItem|InvoiceItem|CreditmemoItem $item
  * @return mixed
  */
 public function getTotalAmount($item)
 {
     return $this->itemPriceRenderer->getTotalAmount($item);
 }