8 use \Magento\Tax\Model\Config;
44 $this->taxHelperMock = $this->createMock(\
Magento\Tax\Helper\Data::class);
45 $this->taxConfigMock = $this->createMock(\
Magento\Tax\Model\Config::class);
46 $this->checkoutSessionMock = $this->createMock(\
Magento\Checkout\Model\Session::class);
47 $this->scopeConfigMock = $this->createMock(\
Magento\Framework\
App\
Config\ScopeConfigInterface::class);
48 $this->quoteMock = $this->createMock(\
Magento\Quote\Model\Quote::class);
49 $this->checkoutSessionMock->expects($this->any())->method(
'getQuote')->willReturn($this->quoteMock);
50 $this->model = new \Magento\Tax\Model\TaxConfigProvider(
53 $this->checkoutSessionMock,
54 $this->scopeConfigMock
81 $this->taxConfigMock->expects($this->any())->method(
'displayCartShippingBoth')
82 ->will($this->returnValue($cartShippingBoth));
83 $this->taxConfigMock->expects($this->any())->method(
'displayCartShippingExclTax')
84 ->will($this->returnValue($cartShippingExclTax));
86 $this->taxHelperMock->expects($this->any())->method(
'displayCartBothPrices')
87 ->will($this->returnValue($cartBothPrices));
88 $this->taxHelperMock->expects($this->any())->method(
'displayCartPriceExclTax')
89 ->will($this->returnValue($cartPriceExclTax));
91 $this->taxConfigMock->expects($this->any())->method(
'displayCartSubtotalBoth')
92 ->will($this->returnValue($cartSubTotalBoth));
93 $this->taxConfigMock->expects($this->any())->method(
'displayCartSubtotalExclTax')
94 ->will($this->returnValue($cartSubTotalExclTax));
96 $this->taxHelperMock->expects(($this->any()))->method(
'displayShippingPriceExcludingTax')
97 ->will($this->returnValue(1));
98 $this->taxHelperMock->expects(($this->any()))->method(
'displayShippingBothPrices')
99 ->will($this->returnValue(1));
100 $this->taxHelperMock->expects(($this->any()))->method(
'displayFullSummary')
101 ->will($this->returnValue(1));
102 $this->taxConfigMock->expects(($this->any()))->method(
'displayCartTaxWithGrandTotal')
103 ->will($this->returnValue(1));
104 $this->taxConfigMock->expects(($this->any()))->method(
'displayCartZeroTax')
105 ->will($this->returnValue(1));
111 $this->scopeConfigMock->expects($this->atLeastOnce())
113 ->willReturnMap($valueMap);
114 $this->quoteMock->expects($this->any())->method(
'isVirtual')->willReturn($isQuoteVirtual);
115 $this->assertEquals($expectedResult, $this->model->getConfig());
126 'expectedResult' => [
127 'isDisplayShippingPriceExclTax' => 1,
128 'isDisplayShippingBothPrices' => 1,
129 'reviewShippingDisplayMode' =>
'both',
130 'reviewItemPriceDisplayMode' =>
'both',
131 'reviewTotalsDisplayMode' =>
'both',
132 'includeTaxInGrandTotal' => 1,
133 'isFullTaxSummaryDisplayed' => 1,
134 'isZeroTaxDisplayed' => 1,
135 'reloadOnBillingAddress' =>
false,
136 'defaultCountryId' =>
'US',
137 'defaultRegionId' => 12,
138 'defaultPostcode' =>
'*',
140 'cartShippingBoth' => 1,
141 'cartShippingExclTax' => 1,
142 'cartBothPrices' => 1,
143 'cartPriceExclTax' => 1,
144 'cartSubTotalBoth' => 1,
145 'cartSubTotalExclTax' => 1,
146 'isQuoteVirtual' =>
false,
155 'expectedResult' => [
156 'isDisplayShippingPriceExclTax' => 1,
157 'isDisplayShippingBothPrices' => 1,
158 'reviewShippingDisplayMode' =>
'excluding',
159 'reviewItemPriceDisplayMode' =>
'excluding',
160 'reviewTotalsDisplayMode' =>
'excluding',
161 'includeTaxInGrandTotal' => 1,
162 'isFullTaxSummaryDisplayed' => 1,
163 'isZeroTaxDisplayed' => 1,
164 'reloadOnBillingAddress' =>
true,
165 'defaultCountryId' =>
'US',
166 'defaultRegionId' => 12,
167 'defaultPostcode' =>
'*',
169 'cartShippingBoth' => 0,
170 'cartShippingExclTax' => 1,
171 'cartBothPrices' => 0,
172 'cartPriceExclTax' => 1,
173 'cartSubTotalBoth' => 0,
174 'cartSubTotalExclTax' => 1,
175 'isQuoteVirtual' =>
false,
184 'expectedResult' => [
185 'isDisplayShippingPriceExclTax' => 1,
186 'isDisplayShippingBothPrices' => 1,
187 'reviewShippingDisplayMode' =>
'including',
188 'reviewItemPriceDisplayMode' =>
'including',
189 'reviewTotalsDisplayMode' =>
'including',
190 'includeTaxInGrandTotal' => 1,
191 'isFullTaxSummaryDisplayed' => 1,
192 'isZeroTaxDisplayed' => 1,
193 'reloadOnBillingAddress' =>
true,
194 'defaultCountryId' =>
'US',
195 'defaultRegionId' => 12,
196 'defaultPostcode' =>
'*',
198 'cartShippingBoth' => 0,
199 'cartShippingExclTax' => 0,
200 'cartBothPrices' => 0,
201 'cartPriceExclTax' => 0,
202 'cartSubTotalBoth' => 0,
203 'cartSubTotalExclTax' => 0,
204 'isQuoteVirtual' =>
true,
213 'expectedResult' => [
214 'isDisplayShippingPriceExclTax' => 1,
215 'isDisplayShippingBothPrices' => 1,
216 'reviewShippingDisplayMode' =>
'including',
217 'reviewItemPriceDisplayMode' =>
'including',
218 'reviewTotalsDisplayMode' =>
'including',
219 'includeTaxInGrandTotal' => 1,
220 'isFullTaxSummaryDisplayed' => 1,
221 'isZeroTaxDisplayed' => 1,
222 'reloadOnBillingAddress' =>
true,
223 'defaultCountryId' =>
'US',
224 'defaultRegionId' => 12,
225 'defaultPostcode' =>
'*',
227 'cartShippingBoth' => 0,
228 'cartShippingExclTax' => 0,
229 'cartBothPrices' => 0,
230 'cartPriceExclTax' => 0,
231 'cartSubTotalBoth' => 0,
232 'cartSubTotalExclTax' => 0,
233 'isQuoteVirtual' =>
true,
242 'expectedResult' => [
243 'isDisplayShippingPriceExclTax' => 1,
244 'isDisplayShippingBothPrices' => 1,
245 'reviewShippingDisplayMode' =>
'both',
246 'reviewItemPriceDisplayMode' =>
'both',
247 'reviewTotalsDisplayMode' =>
'both',
248 'includeTaxInGrandTotal' => 1,
249 'isFullTaxSummaryDisplayed' => 1,
250 'isZeroTaxDisplayed' => 1,
251 'reloadOnBillingAddress' =>
false,
252 'defaultCountryId' =>
'US',
253 'defaultRegionId' => 12,
254 'defaultPostcode' =>
'*',
256 'cartShippingBoth' => 1,
257 'cartShippingExclTax' => 0,
258 'cartBothPrices' => 1,
259 'cartPriceExclTax' => 0,
260 'cartSubTotalBoth' => 1,
261 'cartSubTotalExclTax' => 0,
262 'isQuoteVirtual' =>
false,
271 'expectedResult' => [
272 'isDisplayShippingPriceExclTax' => 1,
273 'isDisplayShippingBothPrices' => 1,
274 'reviewShippingDisplayMode' =>
'excluding',
275 'reviewItemPriceDisplayMode' =>
'including',
276 'reviewTotalsDisplayMode' =>
'both',
277 'includeTaxInGrandTotal' => 1,
278 'isFullTaxSummaryDisplayed' => 1,
279 'isZeroTaxDisplayed' => 1,
280 'reloadOnBillingAddress' =>
false,
281 'defaultCountryId' =>
'US',
282 'defaultRegionId' => 12,
283 'defaultPostcode' =>
'*',
285 'cartShippingBoth' => 0,
286 'cartShippingExclTax' => 1,
287 'cartBothPrices' => 0,
288 'cartPriceExclTax' => 0,
289 'cartSubTotalBoth' => 1,
290 'cartSubTotalExclTax' => 0,
291 'isQuoteVirtual' =>
false,
299 'zeroRegionToNull' => [
300 'expectedResult' => [
301 'isDisplayShippingPriceExclTax' => 1,
302 'isDisplayShippingBothPrices' => 1,
303 'reviewShippingDisplayMode' =>
'excluding',
304 'reviewItemPriceDisplayMode' =>
'including',
305 'reviewTotalsDisplayMode' =>
'both',
306 'includeTaxInGrandTotal' => 1,
307 'isFullTaxSummaryDisplayed' => 1,
308 'isZeroTaxDisplayed' => 1,
309 'reloadOnBillingAddress' =>
false,
310 'defaultCountryId' =>
'US',
311 'defaultRegionId' =>
null,
312 'defaultPostcode' =>
'*',
314 'cartShippingBoth' => 0,
315 'cartShippingExclTax' => 1,
316 'cartBothPrices' => 0,
317 'cartPriceExclTax' => 0,
318 'cartSubTotalBoth' => 1,
319 'cartSubTotalExclTax' => 0,
320 'isQuoteVirtual' =>
false,
const CONFIG_XML_PATH_DEFAULT_POSTCODE
const CONFIG_XML_PATH_DEFAULT_REGION
const CONFIG_XML_PATH_DEFAULT_COUNTRY
testGetConfig( $expectedResult, $cartShippingBoth, $cartShippingExclTax, $cartBothPrices, $cartPriceExclTax, $cartSubTotalBoth, $cartSubTotalExclTax, $isQuoteVirtual, $config)
const CONFIG_XML_PATH_BASED_ON