5
5
*/
6
6
namespace Magento \Tax \Test \Unit \Model ;
7
7
8
+ use \Magento \Tax \Model \Config ;
8
9
class TaxConfigProviderTest extends \PHPUnit_Framework_TestCase
9
10
{
10
11
/**
@@ -79,8 +80,8 @@ public function testGetConfig(
79
80
$ cartPriceExclTax ,
80
81
$ cartSubTotalBoth ,
81
82
$ cartSubTotalExclTax ,
82
- $ calculationType ,
83
- $ isQuoteVirtual
83
+ $ isQuoteVirtual ,
84
+ $ config
84
85
) {
85
86
$ this ->taxConfigMock ->expects ($ this ->any ())->method ('displayCartShippingBoth ' )
86
87
->will ($ this ->returnValue ($ cartShippingBoth ));
@@ -107,10 +108,14 @@ public function testGetConfig(
107
108
->will ($ this ->returnValue (1 ));
108
109
$ this ->taxConfigMock ->expects (($ this ->any ()))->method ('displayCartZeroTax ' )
109
110
->will ($ this ->returnValue (1 ));
110
- $ this ->scopeConfigMock ->expects ($ this ->once ())
111
+
112
+ $ valueMap = [];
113
+ foreach ($ config as $ key => $ value ) {
114
+ $ valueMap [] = [$ key , \Magento \Store \Model \ScopeInterface::SCOPE_STORE , null , $ value ];
115
+ }
116
+ $ this ->scopeConfigMock ->expects ($ this ->atLeastOnce ())
111
117
->method ('getValue ' )
112
- ->with (\Magento \Tax \Model \Config::CONFIG_XML_PATH_BASED_ON )
113
- ->willReturn ($ calculationType );
118
+ ->willReturnMap ($ valueMap );
114
119
$ this ->quoteMock ->expects ($ this ->any ())->method ('isVirtual ' )->willReturn ($ isQuoteVirtual );
115
120
$ this ->assertEquals ($ expectedResult , $ this ->model ->getConfig ());
116
121
}
@@ -133,15 +138,23 @@ public function getConfigDataProvider()
133
138
'isFullTaxSummaryDisplayed ' => 1 ,
134
139
'isZeroTaxDisplayed ' => 1 ,
135
140
'reloadOnBillingAddress ' => false ,
141
+ 'defaultCountryId ' => 'US ' ,
142
+ 'defaultRegionId ' => 12 ,
143
+ 'defaultPostcode ' => '* ' ,
136
144
],
137
145
'cartShippingBoth ' => 1 ,
138
146
'cartShippingExclTax ' => 1 ,
139
147
'cartBothPrices ' => 1 ,
140
148
'cartPriceExclTax ' => 1 ,
141
149
'cartSubTotalBoth ' => 1 ,
142
150
'cartSubTotalExclTax ' => 1 ,
143
- 'calculationType ' => 'shipping ' ,
144
151
'isQuoteVirtual ' => false ,
152
+ 'config ' => [
153
+ Config::CONFIG_XML_PATH_BASED_ON => 'shipping ' ,
154
+ Config::CONFIG_XML_PATH_DEFAULT_COUNTRY => 'US ' ,
155
+ Config::CONFIG_XML_PATH_DEFAULT_REGION => 12 ,
156
+ Config::CONFIG_XML_PATH_DEFAULT_POSTCODE => '* ' ,
157
+ ],
145
158
],
146
159
[
147
160
'expectedResult ' => [
@@ -154,15 +167,23 @@ public function getConfigDataProvider()
154
167
'isFullTaxSummaryDisplayed ' => 1 ,
155
168
'isZeroTaxDisplayed ' => 1 ,
156
169
'reloadOnBillingAddress ' => true ,
170
+ 'defaultCountryId ' => 'US ' ,
171
+ 'defaultRegionId ' => 12 ,
172
+ 'defaultPostcode ' => '* ' ,
157
173
],
158
174
'cartShippingBoth ' => 0 ,
159
175
'cartShippingExclTax ' => 1 ,
160
176
'cartBothPrices ' => 0 ,
161
177
'cartPriceExclTax ' => 1 ,
162
178
'cartSubTotalBoth ' => 0 ,
163
179
'cartSubTotalExclTax ' => 1 ,
164
- 'calculationType ' => 'billing ' ,
165
180
'isQuoteVirtual ' => false ,
181
+ 'config ' => [
182
+ Config::CONFIG_XML_PATH_BASED_ON => 'billing ' ,
183
+ Config::CONFIG_XML_PATH_DEFAULT_COUNTRY => 'US ' ,
184
+ Config::CONFIG_XML_PATH_DEFAULT_REGION => 12 ,
185
+ Config::CONFIG_XML_PATH_DEFAULT_POSTCODE => '* ' ,
186
+ ],
166
187
],
167
188
[
168
189
'expectedResult ' => [
@@ -175,15 +196,23 @@ public function getConfigDataProvider()
175
196
'isFullTaxSummaryDisplayed ' => 1 ,
176
197
'isZeroTaxDisplayed ' => 1 ,
177
198
'reloadOnBillingAddress ' => true ,
199
+ 'defaultCountryId ' => 'US ' ,
200
+ 'defaultRegionId ' => 12 ,
201
+ 'defaultPostcode ' => '* ' ,
178
202
],
179
203
'cartShippingBoth ' => 0 ,
180
204
'cartShippingExclTax ' => 0 ,
181
205
'cartBothPrices ' => 0 ,
182
206
'cartPriceExclTax ' => 0 ,
183
207
'cartSubTotalBoth ' => 0 ,
184
208
'cartSubTotalExclTax ' => 0 ,
185
- 'calculationType ' => 'shipping ' ,
186
209
'isQuoteVirtual ' => true ,
210
+ 'config ' => [
211
+ Config::CONFIG_XML_PATH_BASED_ON => 'shipping ' ,
212
+ Config::CONFIG_XML_PATH_DEFAULT_COUNTRY => 'US ' ,
213
+ Config::CONFIG_XML_PATH_DEFAULT_REGION => 12 ,
214
+ Config::CONFIG_XML_PATH_DEFAULT_POSTCODE => '* ' ,
215
+ ],
187
216
],
188
217
[
189
218
'expectedResult ' => [
@@ -196,15 +225,23 @@ public function getConfigDataProvider()
196
225
'isFullTaxSummaryDisplayed ' => 1 ,
197
226
'isZeroTaxDisplayed ' => 1 ,
198
227
'reloadOnBillingAddress ' => true ,
228
+ 'defaultCountryId ' => 'US ' ,
229
+ 'defaultRegionId ' => 12 ,
230
+ 'defaultPostcode ' => '* ' ,
199
231
],
200
232
'cartShippingBoth ' => 0 ,
201
233
'cartShippingExclTax ' => 0 ,
202
234
'cartBothPrices ' => 0 ,
203
235
'cartPriceExclTax ' => 0 ,
204
236
'cartSubTotalBoth ' => 0 ,
205
237
'cartSubTotalExclTax ' => 0 ,
206
- 'calculationType ' => 'billing ' ,
207
238
'isQuoteVirtual ' => true ,
239
+ 'config ' => [
240
+ Config::CONFIG_XML_PATH_BASED_ON => 'billing ' ,
241
+ Config::CONFIG_XML_PATH_DEFAULT_COUNTRY => 'US ' ,
242
+ Config::CONFIG_XML_PATH_DEFAULT_REGION => 12 ,
243
+ Config::CONFIG_XML_PATH_DEFAULT_POSTCODE => '* ' ,
244
+ ],
208
245
],
209
246
[
210
247
'expectedResult ' => [
@@ -217,15 +254,23 @@ public function getConfigDataProvider()
217
254
'isFullTaxSummaryDisplayed ' => 1 ,
218
255
'isZeroTaxDisplayed ' => 1 ,
219
256
'reloadOnBillingAddress ' => false ,
257
+ 'defaultCountryId ' => 'US ' ,
258
+ 'defaultRegionId ' => 12 ,
259
+ 'defaultPostcode ' => '* ' ,
220
260
],
221
261
'cartShippingBoth ' => 1 ,
222
262
'cartShippingExclTax ' => 0 ,
223
263
'cartBothPrices ' => 1 ,
224
264
'cartPriceExclTax ' => 0 ,
225
265
'cartSubTotalBoth ' => 1 ,
226
266
'cartSubTotalExclTax ' => 0 ,
227
- 'calculationType ' => 'shipping ' ,
228
267
'isQuoteVirtual ' => false ,
268
+ 'config ' => [
269
+ Config::CONFIG_XML_PATH_BASED_ON => 'shipping ' ,
270
+ Config::CONFIG_XML_PATH_DEFAULT_COUNTRY => 'US ' ,
271
+ Config::CONFIG_XML_PATH_DEFAULT_REGION => 12 ,
272
+ Config::CONFIG_XML_PATH_DEFAULT_POSTCODE => '* ' ,
273
+ ],
229
274
],
230
275
[
231
276
'expectedResult ' => [
@@ -238,15 +283,23 @@ public function getConfigDataProvider()
238
283
'isFullTaxSummaryDisplayed ' => 1 ,
239
284
'isZeroTaxDisplayed ' => 1 ,
240
285
'reloadOnBillingAddress ' => false ,
286
+ 'defaultCountryId ' => 'US ' ,
287
+ 'defaultRegionId ' => 12 ,
288
+ 'defaultPostcode ' => '* ' ,
241
289
],
242
290
'cartShippingBoth ' => 0 ,
243
291
'cartShippingExclTax ' => 1 ,
244
292
'cartBothPrices ' => 0 ,
245
293
'cartPriceExclTax ' => 0 ,
246
294
'cartSubTotalBoth ' => 1 ,
247
295
'cartSubTotalExclTax ' => 0 ,
248
- 'calculationType ' => 'shipping ' ,
249
296
'isQuoteVirtual ' => false ,
297
+ 'config ' => [
298
+ Config::CONFIG_XML_PATH_BASED_ON => 'shipping ' ,
299
+ Config::CONFIG_XML_PATH_DEFAULT_COUNTRY => 'US ' ,
300
+ Config::CONFIG_XML_PATH_DEFAULT_REGION => 12 ,
301
+ Config::CONFIG_XML_PATH_DEFAULT_POSTCODE => '* ' ,
302
+ ],
250
303
],
251
304
];
252
305
}
0 commit comments