@@ -84,6 +84,11 @@ class TierPriceTest extends TestCase
84
84
*/
85
85
private $ customerGroupRetriever ;
86
86
87
+ /**
88
+ * @var MockObject
89
+ */
90
+ private $ scopeConfigMock ;
91
+
87
92
/**
88
93
* Initialize base dependencies
89
94
*/
@@ -108,6 +113,7 @@ protected function setUp(): void
108
113
$ this ->groupManagement = $ this ->getMockForAbstractClass (GroupManagementInterface::class);
109
114
110
115
$ this ->priceCurrencyMock = $ this ->getMockForAbstractClass (PriceCurrencyInterface::class);
116
+ $ this ->scopeConfigMock = $ this ->getMockForAbstractClass (\Magento \Framework \App \Config \ScopeConfigInterface::class);
111
117
112
118
$ this ->model = new TierPrice (
113
119
$ this ->product ,
@@ -116,7 +122,8 @@ protected function setUp(): void
116
122
$ this ->priceCurrencyMock ,
117
123
$ this ->session ,
118
124
$ this ->groupManagement ,
119
- $ this ->customerGroupRetriever
125
+ $ this ->customerGroupRetriever ,
126
+ $ this ->scopeConfigMock
120
127
);
121
128
}
122
129
@@ -242,7 +249,8 @@ public function testGetterStoredTierPrices()
242
249
$ this ->priceCurrencyMock ,
243
250
$ this ->session ,
244
251
$ this ->groupManagement ,
245
- $ this ->customerGroupRetriever
252
+ $ this ->customerGroupRetriever ,
253
+ $ this ->scopeConfigMock
246
254
);
247
255
$ group = $ this ->createMock (\Magento \Customer \Model \Data \Group::class);
248
256
$ group ->expects ($ this ->once ())->method ('getId ' )->willReturn (GroupManagement::CUST_GROUP_ALL );
@@ -305,21 +313,21 @@ public function providerForGetterTierPriceList()
305
313
'tierPrices ' => [
306
314
// will be ignored due to customer group
307
315
[
308
- 'price ' => '1 .3 ' ,
309
- 'website_price ' => '1 .3 ' ,
316
+ 'price ' => '21 .3 ' ,
317
+ 'website_price ' => '21 .3 ' ,
310
318
'price_qty ' => '1.3 ' ,
311
319
'cust_group ' => $ this ->customerGroup + 1
312
320
],
313
321
[
314
- 'price ' => '25 .4 ' ,
315
- 'website_price ' => '25 .4 ' ,
322
+ 'price ' => '20 .4 ' ,
323
+ 'website_price ' => '20 .4 ' ,
316
324
'price_qty ' => '5. ' ,
317
325
'cust_group ' => Group::CUST_GROUP_ALL
318
326
],
319
327
// cases to calculate save percent
320
328
[
321
- 'price ' => '15 .1 ' ,
322
- 'website_price ' => '15 .1 ' ,
329
+ 'price ' => '20 .1 ' ,
330
+ 'website_price ' => '20 .1 ' ,
323
331
'price_qty ' => '5. ' ,
324
332
'cust_group ' => Group::CUST_GROUP_ALL
325
333
],
@@ -339,8 +347,8 @@ public function providerForGetterTierPriceList()
339
347
'basePrice ' => 20. ,
340
348
'expectedResult ' => [
341
349
[
342
- 'price ' => '7.55 ' ,
343
- 'website_price ' => '7.55 ' ,
350
+ 'price ' => '10.05 ' ,
351
+ 'website_price ' => '10.05 ' ,
344
352
'price_qty ' => '5. ' ,
345
353
'cust_group ' => Group::CUST_GROUP_ALL ,
346
354
],
@@ -418,7 +426,8 @@ public function testGetQuantity($quantity, $expectedValue)
418
426
$ this ->priceCurrencyMock ,
419
427
$ this ->session ,
420
428
$ this ->groupManagement ,
421
- $ this ->customerGroupRetriever
429
+ $ this ->customerGroupRetriever ,
430
+ $ this ->scopeConfigMock
422
431
);
423
432
424
433
$ this ->assertEquals ($ expectedValue , $ tierPrice ->getQuantity ());
0 commit comments