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