/** * @dataProvider getConfigDataProvider * @param array $expectedResult * @param int $cartShippingBoth * @param int $cartShippingExclTax * @param int $cartBothPrices * @param int $cartPriceExclTax * @param int $cartSubTotalBoth * @param int $cartSubTotalExclTax */ public function testGetConfig($expectedResult, $cartShippingBoth, $cartShippingExclTax, $cartBothPrices, $cartPriceExclTax, $cartSubTotalBoth, $cartSubTotalExclTax) { $this->taxConfigMock->expects($this->any())->method('displayCartShippingBoth')->will($this->returnValue($cartShippingBoth)); $this->taxConfigMock->expects($this->any())->method('displayCartShippingExclTax')->will($this->returnValue($cartShippingExclTax)); $this->taxHelperMock->expects($this->any())->method('displayCartBothPrices')->will($this->returnValue($cartBothPrices)); $this->taxHelperMock->expects($this->any())->method('displayCartPriceExclTax')->will($this->returnValue($cartPriceExclTax)); $this->taxConfigMock->expects($this->any())->method('displayCartSubtotalBoth')->will($this->returnValue($cartSubTotalBoth)); $this->taxConfigMock->expects($this->any())->method('displayCartSubtotalExclTax')->will($this->returnValue($cartSubTotalExclTax)); $this->taxHelperMock->expects($this->any())->method('displayShippingPriceExcludingTax')->will($this->returnValue(1)); $this->taxHelperMock->expects($this->any())->method('displayShippingBothPrices')->will($this->returnValue(1)); $this->taxHelperMock->expects($this->any())->method('displayFullSummary')->will($this->returnValue(1)); $this->taxConfigMock->expects($this->any())->method('displayCartTaxWithGrandTotal')->will($this->returnValue(1)); $this->taxConfigMock->expects($this->any())->method('displayCartZeroTax')->will($this->returnValue(1)); $this->assertEquals($expectedResult, $this->model->getConfig()); }
/** * @dataProvider getConfigDataProvider * @param array $expectedResult * @param int $cartShippingBoth * @param int $cartShippingExclTax * @param int $cartBothPrices * @param int $cartPriceExclTax * @param int $cartSubTotalBoth * @param int $cartSubTotalExclTax * @param string|null $calculationType * @param bool $isQuoteVirtual */ public function testGetConfig($expectedResult, $cartShippingBoth, $cartShippingExclTax, $cartBothPrices, $cartPriceExclTax, $cartSubTotalBoth, $cartSubTotalExclTax, $calculationType, $isQuoteVirtual) { $this->taxConfigMock->expects($this->any())->method('displayCartShippingBoth')->will($this->returnValue($cartShippingBoth)); $this->taxConfigMock->expects($this->any())->method('displayCartShippingExclTax')->will($this->returnValue($cartShippingExclTax)); $this->taxHelperMock->expects($this->any())->method('displayCartBothPrices')->will($this->returnValue($cartBothPrices)); $this->taxHelperMock->expects($this->any())->method('displayCartPriceExclTax')->will($this->returnValue($cartPriceExclTax)); $this->taxConfigMock->expects($this->any())->method('displayCartSubtotalBoth')->will($this->returnValue($cartSubTotalBoth)); $this->taxConfigMock->expects($this->any())->method('displayCartSubtotalExclTax')->will($this->returnValue($cartSubTotalExclTax)); $this->taxHelperMock->expects($this->any())->method('displayShippingPriceExcludingTax')->will($this->returnValue(1)); $this->taxHelperMock->expects($this->any())->method('displayShippingBothPrices')->will($this->returnValue(1)); $this->taxHelperMock->expects($this->any())->method('displayFullSummary')->will($this->returnValue(1)); $this->taxConfigMock->expects($this->any())->method('displayCartTaxWithGrandTotal')->will($this->returnValue(1)); $this->taxConfigMock->expects($this->any())->method('displayCartZeroTax')->will($this->returnValue(1)); $this->scopeConfigMock->expects($this->once())->method('getValue')->with(\Magento\Tax\Model\Config::CONFIG_XML_PATH_BASED_ON)->willReturn($calculationType); $this->quoteMock->expects($this->any())->method('isVirtual')->willReturn($isQuoteVirtual); $this->assertEquals($expectedResult, $this->model->getConfig()); }
/** * @dataProvider getConfigDataProvider * @param array $expectedResult * @param int $cartShippingBoth * @param int $cartShippingExclTax * @param int $cartBothPrices * @param int $cartPriceExclTax * @param int $cartSubTotalBoth * @param int $cartSubTotalExclTax * @param string|null $calculationType * @param bool $isQuoteVirtual */ public function testGetConfig($expectedResult, $cartShippingBoth, $cartShippingExclTax, $cartBothPrices, $cartPriceExclTax, $cartSubTotalBoth, $cartSubTotalExclTax, $isQuoteVirtual, $config) { $this->taxConfigMock->expects($this->any())->method('displayCartShippingBoth')->will($this->returnValue($cartShippingBoth)); $this->taxConfigMock->expects($this->any())->method('displayCartShippingExclTax')->will($this->returnValue($cartShippingExclTax)); $this->taxHelperMock->expects($this->any())->method('displayCartBothPrices')->will($this->returnValue($cartBothPrices)); $this->taxHelperMock->expects($this->any())->method('displayCartPriceExclTax')->will($this->returnValue($cartPriceExclTax)); $this->taxConfigMock->expects($this->any())->method('displayCartSubtotalBoth')->will($this->returnValue($cartSubTotalBoth)); $this->taxConfigMock->expects($this->any())->method('displayCartSubtotalExclTax')->will($this->returnValue($cartSubTotalExclTax)); $this->taxHelperMock->expects($this->any())->method('displayShippingPriceExcludingTax')->will($this->returnValue(1)); $this->taxHelperMock->expects($this->any())->method('displayShippingBothPrices')->will($this->returnValue(1)); $this->taxHelperMock->expects($this->any())->method('displayFullSummary')->will($this->returnValue(1)); $this->taxConfigMock->expects($this->any())->method('displayCartTaxWithGrandTotal')->will($this->returnValue(1)); $this->taxConfigMock->expects($this->any())->method('displayCartZeroTax')->will($this->returnValue(1)); $valueMap = []; foreach ($config as $key => $value) { $valueMap[] = [$key, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, null, $value]; } $this->scopeConfigMock->expects($this->atLeastOnce())->method('getValue')->willReturnMap($valueMap); $this->quoteMock->expects($this->any())->method('isVirtual')->willReturn($isQuoteVirtual); $this->assertEquals($expectedResult, $this->model->getConfig()); }