@@ -76,7 +76,8 @@ protected function setUp()
76
76
'addQty ' ,
77
77
'setCustomPrice ' ,
78
78
'setOriginalCustomPrice ' ,
79
- 'setData '
79
+ 'setData ' ,
80
+ 'setprice '
80
81
]);
81
82
$ this ->quoteItemFactoryMock ->expects ($ this ->any ())
82
83
->method ('create ' )
@@ -98,7 +99,7 @@ protected function setUp()
98
99
99
100
$ this ->productMock = $ this ->createPartialMock (
100
101
\Magento \Catalog \Model \Product::class,
101
- ['getCustomOptions ' , '__wakeup ' , 'getParentProductId ' , 'getCartQty ' , 'getStickWithinParent ' ]
102
+ ['getCustomOptions ' , '__wakeup ' , 'getParentProductId ' , 'getCartQty ' , 'getStickWithinParent ' , ' getFinalPrice ' ]
102
103
);
103
104
$ this ->objectMock = $ this ->createPartialMock (
104
105
\Magento \Framework \DataObject::class,
@@ -239,13 +240,17 @@ public function testPrepare()
239
240
$ customPrice = 400000000 ;
240
241
$ itemId = 1 ;
241
242
$ requestItemId = 1 ;
243
+ $ finalPrice = 1000000000 ;
242
244
243
245
$ this ->productMock ->expects ($ this ->any ())
244
246
->method ('getCartQty ' )
245
247
->will ($ this ->returnValue ($ qty ));
246
248
$ this ->productMock ->expects ($ this ->any ())
247
249
->method ('getStickWithinParent ' )
248
250
->will ($ this ->returnValue (false ));
251
+ $ this ->productMock ->expects ($ this ->once ())
252
+ ->method ('getFinalPrice ' )
253
+ ->will ($ this ->returnValue ($ finalPrice ));
249
254
250
255
$ this ->itemMock ->expects ($ this ->once ())
251
256
->method ('addQty ' )
@@ -255,6 +260,9 @@ public function testPrepare()
255
260
->will ($ this ->returnValue ($ itemId ));
256
261
$ this ->itemMock ->expects ($ this ->never ())
257
262
->method ('setData ' );
263
+ $ this ->itemMock ->expects ($ this ->once ())
264
+ ->method ('setPrice ' )
265
+ ->will ($ this ->returnValue ($ this ->itemMock ));
258
266
259
267
$ this ->objectMock ->expects ($ this ->any ())
260
268
->method ('getCustomPrice ' )
@@ -282,13 +290,17 @@ public function testPrepareWithResetCountAndStick()
282
290
$ customPrice = 400000000 ;
283
291
$ itemId = 1 ;
284
292
$ requestItemId = 1 ;
293
+ $ finalPrice = 1000000000 ;
285
294
286
295
$ this ->productMock ->expects ($ this ->any ())
287
296
->method ('getCartQty ' )
288
297
->will ($ this ->returnValue ($ qty ));
289
298
$ this ->productMock ->expects ($ this ->any ())
290
299
->method ('getStickWithinParent ' )
291
300
->will ($ this ->returnValue (true ));
301
+ $ this ->productMock ->expects ($ this ->once ())
302
+ ->method ('getFinalPrice ' )
303
+ ->will ($ this ->returnValue ($ finalPrice ));
292
304
293
305
$ this ->itemMock ->expects ($ this ->once ())
294
306
->method ('addQty ' )
@@ -298,6 +310,9 @@ public function testPrepareWithResetCountAndStick()
298
310
->will ($ this ->returnValue ($ itemId ));
299
311
$ this ->itemMock ->expects ($ this ->never ())
300
312
->method ('setData ' );
313
+ $ this ->itemMock ->expects ($ this ->once ())
314
+ ->method ('setPrice ' )
315
+ ->will ($ this ->returnValue ($ this ->itemMock ));
301
316
302
317
$ this ->objectMock ->expects ($ this ->any ())
303
318
->method ('getCustomPrice ' )
@@ -325,13 +340,17 @@ public function testPrepareWithResetCountAndNotStickAndOtherItemId()
325
340
$ customPrice = 400000000 ;
326
341
$ itemId = 1 ;
327
342
$ requestItemId = 2 ;
343
+ $ finalPrice = 1000000000 ;
328
344
329
345
$ this ->productMock ->expects ($ this ->any ())
330
346
->method ('getCartQty ' )
331
347
->will ($ this ->returnValue ($ qty ));
332
348
$ this ->productMock ->expects ($ this ->any ())
333
349
->method ('getStickWithinParent ' )
334
350
->will ($ this ->returnValue (false ));
351
+ $ this ->productMock ->expects ($ this ->once ())
352
+ ->method ('getFinalPrice ' )
353
+ ->will ($ this ->returnValue ($ finalPrice ));
335
354
336
355
$ this ->itemMock ->expects ($ this ->once ())
337
356
->method ('addQty ' )
@@ -341,6 +360,9 @@ public function testPrepareWithResetCountAndNotStickAndOtherItemId()
341
360
->will ($ this ->returnValue ($ itemId ));
342
361
$ this ->itemMock ->expects ($ this ->never ())
343
362
->method ('setData ' );
363
+ $ this ->itemMock ->expects ($ this ->once ())
364
+ ->method ('setPrice ' )
365
+ ->will ($ this ->returnValue ($ this ->itemMock ));
344
366
345
367
$ this ->objectMock ->expects ($ this ->any ())
346
368
->method ('getCustomPrice ' )
@@ -368,6 +390,7 @@ public function testPrepareWithResetCountAndNotStickAndSameItemId()
368
390
$ customPrice = 400000000 ;
369
391
$ itemId = 1 ;
370
392
$ requestItemId = 1 ;
393
+ $ finalPrice = 1000000000 ;
371
394
372
395
$ this ->objectMock ->expects ($ this ->any ())
373
396
->method ('getResetCount ' )
@@ -386,10 +409,16 @@ public function testPrepareWithResetCountAndNotStickAndSameItemId()
386
409
$ this ->productMock ->expects ($ this ->any ())
387
410
->method ('getStickWithinParent ' )
388
411
->will ($ this ->returnValue (false ));
412
+ $ this ->productMock ->expects ($ this ->once ())
413
+ ->method ('getFinalPrice ' )
414
+ ->will ($ this ->returnValue ($ finalPrice ));
389
415
390
416
$ this ->itemMock ->expects ($ this ->once ())
391
417
->method ('addQty ' )
392
418
->with ($ qty );
419
+ $ this ->itemMock ->expects ($ this ->once ())
420
+ ->method ('setPrice ' )
421
+ ->will ($ this ->returnValue ($ this ->itemMock ));
393
422
394
423
$ this ->objectMock ->expects ($ this ->any ())
395
424
->method ('getCustomPrice ' )
0 commit comments