7
7
8
8
namespace Magento \Catalog \Test \Unit \Pricing \Price ;
9
9
10
+ use Magento \Catalog \Pricing \Price \FinalPrice ;
10
11
use Magento \Catalog \Pricing \Price \MinimalTierPriceCalculator ;
11
12
use Magento \Catalog \Pricing \Price \TierPrice ;
12
13
use Magento \Framework \Pricing \Adjustment \CalculatorInterface ;
@@ -73,10 +74,10 @@ private function getValueTierPricesExistShouldReturnMinTierPrice()
73
74
$ notMinPrice = 10 ;
74
75
75
76
$ minAmount = $ this ->getMockForAbstractClass (AmountInterface::class);
76
- $ minAmount ->expects ($ this ->once ())->method ('getValue ' )->willReturn ($ minPrice );
77
+ $ minAmount ->expects ($ this ->atLeastOnce ())->method ('getValue ' )->willReturn ($ minPrice );
77
78
78
79
$ notMinAmount = $ this ->getMockForAbstractClass (AmountInterface::class);
79
- $ notMinAmount ->expects ($ this ->once ())->method ('getValue ' )->willReturn ($ notMinPrice );
80
+ $ notMinAmount ->expects ($ this ->atLeastOnce ())->method ('getValue ' )->willReturn ($ notMinPrice );
80
81
81
82
$ tierPriceList = [
82
83
[
@@ -89,10 +90,12 @@ private function getValueTierPricesExistShouldReturnMinTierPrice()
89
90
90
91
$ this ->price ->expects ($ this ->once ())->method ('getTierPriceList ' )->willReturn ($ tierPriceList );
91
92
92
- $ this ->priceInfo ->expects ($ this ->once ())->method ('getPrice ' )->with (TierPrice::PRICE_CODE )
93
- ->willReturn ($ this ->price );
93
+ $ this ->priceInfo ->expects ($ this ->atLeastOnce ())
94
+ ->method ('getPrice ' )
95
+ ->withConsecutive ([TierPrice::PRICE_CODE ], [FinalPrice::PRICE_CODE ])
96
+ ->willReturnOnConsecutiveCalls ($ this ->price , $ notMinAmount );
94
97
95
- $ this ->saleable ->expects ($ this ->once ())->method ('getPriceInfo ' )->willReturn ($ this ->priceInfo );
98
+ $ this ->saleable ->expects ($ this ->atLeastOnce ())->method ('getPriceInfo ' )->willReturn ($ this ->priceInfo );
96
99
return $ minPrice ;
97
100
}
98
101
@@ -107,12 +110,8 @@ public function testGetGetAmountMinTierPriceExistShouldReturnAmountObject()
107
110
$ minPrice = $ this ->getValueTierPricesExistShouldReturnMinTierPrice ();
108
111
109
112
$ amount = $ this ->getMockForAbstractClass (AmountInterface::class);
113
+ $ amount ->method ('getValue ' )->willReturn ($ minPrice );
110
114
111
- $ this ->calculator ->expects ($ this ->once ())
112
- ->method ('getAmount ' )
113
- ->with ($ minPrice , $ this ->saleable )
114
- ->willReturn ($ amount );
115
-
116
- $ this ->assertSame ($ amount , $ this ->object ->getAmount ($ this ->saleable ));
115
+ $ this ->assertEquals ($ amount , $ this ->object ->getAmount ($ this ->saleable ));
117
116
}
118
117
}
0 commit comments