@@ -76,7 +76,8 @@ protected function setUp()
7676 'addQty ' ,
7777 'setCustomPrice ' ,
7878 'setOriginalCustomPrice ' ,
79- 'setData '
79+ 'setData ' ,
80+ 'setprice '
8081 ]);
8182 $ this ->quoteItemFactoryMock ->expects ($ this ->any ())
8283 ->method ('create ' )
@@ -98,7 +99,7 @@ protected function setUp()
9899
99100 $ this ->productMock = $ this ->createPartialMock (
100101 \Magento \Catalog \Model \Product::class,
101- ['getCustomOptions ' , '__wakeup ' , 'getParentProductId ' , 'getCartQty ' , 'getStickWithinParent ' ]
102+ ['getCustomOptions ' , '__wakeup ' , 'getParentProductId ' , 'getCartQty ' , 'getStickWithinParent ' , ' getFinalPrice ' ]
102103 );
103104 $ this ->objectMock = $ this ->createPartialMock (
104105 \Magento \Framework \DataObject::class,
@@ -239,13 +240,17 @@ public function testPrepare()
239240 $ customPrice = 400000000 ;
240241 $ itemId = 1 ;
241242 $ requestItemId = 1 ;
243+ $ finalPrice = 1000000000 ;
242244
243245 $ this ->productMock ->expects ($ this ->any ())
244246 ->method ('getCartQty ' )
245247 ->will ($ this ->returnValue ($ qty ));
246248 $ this ->productMock ->expects ($ this ->any ())
247249 ->method ('getStickWithinParent ' )
248250 ->will ($ this ->returnValue (false ));
251+ $ this ->productMock ->expects ($ this ->once ())
252+ ->method ('getFinalPrice ' )
253+ ->will ($ this ->returnValue ($ finalPrice ));
249254
250255 $ this ->itemMock ->expects ($ this ->once ())
251256 ->method ('addQty ' )
@@ -255,6 +260,9 @@ public function testPrepare()
255260 ->will ($ this ->returnValue ($ itemId ));
256261 $ this ->itemMock ->expects ($ this ->never ())
257262 ->method ('setData ' );
263+ $ this ->itemMock ->expects ($ this ->once ())
264+ ->method ('setPrice ' )
265+ ->will ($ this ->returnValue ($ this ->itemMock ));
258266
259267 $ this ->objectMock ->expects ($ this ->any ())
260268 ->method ('getCustomPrice ' )
@@ -282,13 +290,17 @@ public function testPrepareWithResetCountAndStick()
282290 $ customPrice = 400000000 ;
283291 $ itemId = 1 ;
284292 $ requestItemId = 1 ;
293+ $ finalPrice = 1000000000 ;
285294
286295 $ this ->productMock ->expects ($ this ->any ())
287296 ->method ('getCartQty ' )
288297 ->will ($ this ->returnValue ($ qty ));
289298 $ this ->productMock ->expects ($ this ->any ())
290299 ->method ('getStickWithinParent ' )
291300 ->will ($ this ->returnValue (true ));
301+ $ this ->productMock ->expects ($ this ->once ())
302+ ->method ('getFinalPrice ' )
303+ ->will ($ this ->returnValue ($ finalPrice ));
292304
293305 $ this ->itemMock ->expects ($ this ->once ())
294306 ->method ('addQty ' )
@@ -298,6 +310,9 @@ public function testPrepareWithResetCountAndStick()
298310 ->will ($ this ->returnValue ($ itemId ));
299311 $ this ->itemMock ->expects ($ this ->never ())
300312 ->method ('setData ' );
313+ $ this ->itemMock ->expects ($ this ->once ())
314+ ->method ('setPrice ' )
315+ ->will ($ this ->returnValue ($ this ->itemMock ));
301316
302317 $ this ->objectMock ->expects ($ this ->any ())
303318 ->method ('getCustomPrice ' )
@@ -325,13 +340,17 @@ public function testPrepareWithResetCountAndNotStickAndOtherItemId()
325340 $ customPrice = 400000000 ;
326341 $ itemId = 1 ;
327342 $ requestItemId = 2 ;
343+ $ finalPrice = 1000000000 ;
328344
329345 $ this ->productMock ->expects ($ this ->any ())
330346 ->method ('getCartQty ' )
331347 ->will ($ this ->returnValue ($ qty ));
332348 $ this ->productMock ->expects ($ this ->any ())
333349 ->method ('getStickWithinParent ' )
334350 ->will ($ this ->returnValue (false ));
351+ $ this ->productMock ->expects ($ this ->once ())
352+ ->method ('getFinalPrice ' )
353+ ->will ($ this ->returnValue ($ finalPrice ));
335354
336355 $ this ->itemMock ->expects ($ this ->once ())
337356 ->method ('addQty ' )
@@ -341,6 +360,9 @@ public function testPrepareWithResetCountAndNotStickAndOtherItemId()
341360 ->will ($ this ->returnValue ($ itemId ));
342361 $ this ->itemMock ->expects ($ this ->never ())
343362 ->method ('setData ' );
363+ $ this ->itemMock ->expects ($ this ->once ())
364+ ->method ('setPrice ' )
365+ ->will ($ this ->returnValue ($ this ->itemMock ));
344366
345367 $ this ->objectMock ->expects ($ this ->any ())
346368 ->method ('getCustomPrice ' )
@@ -368,6 +390,7 @@ public function testPrepareWithResetCountAndNotStickAndSameItemId()
368390 $ customPrice = 400000000 ;
369391 $ itemId = 1 ;
370392 $ requestItemId = 1 ;
393+ $ finalPrice = 1000000000 ;
371394
372395 $ this ->objectMock ->expects ($ this ->any ())
373396 ->method ('getResetCount ' )
@@ -386,10 +409,16 @@ public function testPrepareWithResetCountAndNotStickAndSameItemId()
386409 $ this ->productMock ->expects ($ this ->any ())
387410 ->method ('getStickWithinParent ' )
388411 ->will ($ this ->returnValue (false ));
412+ $ this ->productMock ->expects ($ this ->once ())
413+ ->method ('getFinalPrice ' )
414+ ->will ($ this ->returnValue ($ finalPrice ));
389415
390416 $ this ->itemMock ->expects ($ this ->once ())
391417 ->method ('addQty ' )
392418 ->with ($ qty );
419+ $ this ->itemMock ->expects ($ this ->once ())
420+ ->method ('setPrice ' )
421+ ->will ($ this ->returnValue ($ this ->itemMock ));
393422
394423 $ this ->objectMock ->expects ($ this ->any ())
395424 ->method ('getCustomPrice ' )
0 commit comments