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