public function testInitTotalsNoItems() { $address = $this->getMock('\\Magento\\Sales\\Model\\Quote\\Address', [], [], '', false); $this->item->expects($this->never())->method('getParentItemId'); $this->model->init($this->model->getWebsiteId(), $this->model->getCustomerGroupId(), $this->model->getCouponCode()); $this->model->initTotals([], $address); }
/** * @param $baseRowTotalInclTax * @param $baseRowWeeeTaxInclTax * @param $weeeEnabled * @param $expectedValue * @dataProvider testGetFinalDisplayPriceDataProvider */ public function testGetBaseFinalRowDisplayPriceInclTax($baseRowTotalInclTax, $baseRowWeeeTaxInclTax, $weeeEnabled, $expectedValue) { $this->weeeHelper->expects($this->once())->method('isEnabled')->will($this->returnValue($weeeEnabled)); $this->weeeHelper->expects($this->any())->method('getBaseRowWeeeTaxInclTax')->with($this->item)->will($this->returnValue($baseRowWeeeTaxInclTax)); $this->item->expects($this->once())->method('getBaseRowTotalInclTax')->will($this->returnValue($baseRowTotalInclTax)); $this->assertEquals($expectedValue, $this->renderer->getBaseFinalRowDisplayPriceInclTax()); }
/** * test compare two items first without options and second with options */ public function testCompareItemWithoutOptionWithCompared() { $this->itemMock->expects($this->any())->method('getProductId')->will($this->returnValue(1)); $this->comparedMock->expects($this->any())->method('getProductId')->will($this->returnValue(1)); $this->comparedMock->expects($this->any())->method('getOptions')->will($this->returnValue([$this->getOptionMock('option-1', 1), $this->getOptionMock('option-2', 'option-value'), $this->getOptionMock('option-3', serialize(['value' => 'value-1', 'qty' => 2]))])); $this->itemMock->expects($this->any())->method('getOptions')->will($this->returnValue([])); $this->assertFalse($this->helper->compare($this->itemMock, $this->comparedMock)); }
public function testGetTotalAmount() { $rowTotal = 100; $taxAmount = 10; $hiddenTaxAmount = 2; $discountAmount = 20; $weeeTaxAppliedRowAmount = 10; $expectedResult = $rowTotal + $taxAmount + $hiddenTaxAmount - $discountAmount + $weeeTaxAppliedRowAmount; $this->itemMock->expects($this->once())->method('getRowTotal')->will($this->returnValue($rowTotal)); $this->itemMock->expects($this->once())->method('getTaxAmount')->will($this->returnValue($taxAmount)); $this->itemMock->expects($this->once())->method('getHiddenTaxAmount')->will($this->returnValue($hiddenTaxAmount)); $this->itemMock->expects($this->once())->method('getDiscountAmount')->will($this->returnValue($discountAmount)); $this->itemMock->expects($this->once())->method('getWeeeTaxAppliedRowAmount')->will($this->returnValue($weeeTaxAppliedRowAmount)); $this->assertEquals($expectedResult, $this->block->getTotalAmount($this->itemMock)); }