/** * Whether to display final price that include Weee amounts * * @return bool */ public function displayFinalPrice() { $flag = $this->weeeHelper->typeOfDisplay(WeeeDisplayConfig::DISPLAY_EXCL_DESCR_INCL, $this->getZone(), $this->getStoreId()); if (!$flag) { return false; } if ($this->weeeHelper->getWeeeTaxAppliedAmount($this->getItem()) <= 0) { return false; } return true; }
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)); }