/** * Get final row display price excluding tax, this will add Weee amount to rowTotal * * @return float */ public function getFinalRowDisplayPriceExclTax() { $rowTotalExclTax = $this->getItem()->getRowTotal(); if (!$this->weeeHelper->isEnabled($this->getStoreId())) { return $rowTotalExclTax; } return $rowTotalExclTax + $this->weeeHelper->getWeeeTaxAppliedRowAmount($this->getItem()); }
public function testGetRecursiveAmountBundle() { $testAmountUnit1 = 1; $testAmountUnit2 = 2; $testTotalUnit = $testAmountUnit1 + $testAmountUnit2; $testAmountRow1 = 33; $testAmountRow2 = 444; $testTotalRow = $testAmountRow1 + $testAmountRow2; $itemProductSimple1 = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Item', ['getWeeeTaxAppliedAmount', 'getWeeeTaxAppliedRowAmount'], [], '', false); $itemProductSimple2 = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Item', ['getWeeeTaxAppliedAmount', 'getWeeeTaxAppliedRowAmount'], [], '', false); $itemProductSimple1->expects($this->any())->method('getWeeeTaxAppliedAmount')->will($this->returnValue($testAmountUnit1)); $itemProductSimple1->expects($this->any())->method('getWeeeTaxAppliedRowAmount')->will($this->returnValue($testAmountRow1)); $itemProductSimple2->expects($this->any())->method('getWeeeTaxAppliedAmount')->will($this->returnValue($testAmountUnit2)); $itemProductSimple2->expects($this->any())->method('getWeeeTaxAppliedRowAmount')->will($this->returnValue($testAmountRow2)); $itemProductBundle = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Item', ['getHasChildren', 'isChildrenCalculated', 'getChildren'], [], '', false); $itemProductBundle->expects($this->any())->method('getHasChildren')->will($this->returnValue(true)); $itemProductBundle->expects($this->any())->method('isChildrenCalculated')->will($this->returnValue(true)); $itemProductBundle->expects($this->any())->method('getChildren')->will($this->returnValue([$itemProductSimple1, $itemProductSimple2])); $this->assertEquals($testTotalUnit, $this->helperData->getWeeeTaxAppliedAmount($itemProductBundle)); $this->assertEquals($testTotalRow, $this->helperData->getWeeeTaxAppliedRowAmount($itemProductBundle)); }