@@ -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,13 @@ 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
+ [
103
+ 'getCustomOptions ' ,
104
+ '__wakeup ' ,
105
+ 'getParentProductId ' ,
106
+ 'getCartQty ' ,
107
+ 'getStickWithinParent ' ,
108
+ 'getFinalPrice ' ]
102
109
);
103
110
$ this ->objectMock = $ this ->createPartialMock (
104
111
\Magento \Framework \DataObject::class,
@@ -239,13 +246,17 @@ public function testPrepare()
239
246
$ customPrice = 400000000 ;
240
247
$ itemId = 1 ;
241
248
$ requestItemId = 1 ;
249
+ $ finalPrice = 1000000000 ;
242
250
243
251
$ this ->productMock ->expects ($ this ->any ())
244
252
->method ('getCartQty ' )
245
253
->will ($ this ->returnValue ($ qty ));
246
254
$ this ->productMock ->expects ($ this ->any ())
247
255
->method ('getStickWithinParent ' )
248
256
->will ($ this ->returnValue (false ));
257
+ $ this ->productMock ->expects ($ this ->once ())
258
+ ->method ('getFinalPrice ' )
259
+ ->will ($ this ->returnValue ($ finalPrice ));
249
260
250
261
$ this ->itemMock ->expects ($ this ->once ())
251
262
->method ('addQty ' )
@@ -255,6 +266,9 @@ public function testPrepare()
255
266
->will ($ this ->returnValue ($ itemId ));
256
267
$ this ->itemMock ->expects ($ this ->never ())
257
268
->method ('setData ' );
269
+ $ this ->itemMock ->expects ($ this ->once ())
270
+ ->method ('setPrice ' )
271
+ ->will ($ this ->returnValue ($ this ->itemMock ));
258
272
259
273
$ this ->objectMock ->expects ($ this ->any ())
260
274
->method ('getCustomPrice ' )
@@ -282,13 +296,17 @@ public function testPrepareWithResetCountAndStick()
282
296
$ customPrice = 400000000 ;
283
297
$ itemId = 1 ;
284
298
$ requestItemId = 1 ;
299
+ $ finalPrice = 1000000000 ;
285
300
286
301
$ this ->productMock ->expects ($ this ->any ())
287
302
->method ('getCartQty ' )
288
303
->will ($ this ->returnValue ($ qty ));
289
304
$ this ->productMock ->expects ($ this ->any ())
290
305
->method ('getStickWithinParent ' )
291
306
->will ($ this ->returnValue (true ));
307
+ $ this ->productMock ->expects ($ this ->once ())
308
+ ->method ('getFinalPrice ' )
309
+ ->will ($ this ->returnValue ($ finalPrice ));
292
310
293
311
$ this ->itemMock ->expects ($ this ->once ())
294
312
->method ('addQty ' )
@@ -298,6 +316,9 @@ public function testPrepareWithResetCountAndStick()
298
316
->will ($ this ->returnValue ($ itemId ));
299
317
$ this ->itemMock ->expects ($ this ->never ())
300
318
->method ('setData ' );
319
+ $ this ->itemMock ->expects ($ this ->once ())
320
+ ->method ('setPrice ' )
321
+ ->will ($ this ->returnValue ($ this ->itemMock ));
301
322
302
323
$ this ->objectMock ->expects ($ this ->any ())
303
324
->method ('getCustomPrice ' )
@@ -325,13 +346,17 @@ public function testPrepareWithResetCountAndNotStickAndOtherItemId()
325
346
$ customPrice = 400000000 ;
326
347
$ itemId = 1 ;
327
348
$ requestItemId = 2 ;
349
+ $ finalPrice = 1000000000 ;
328
350
329
351
$ this ->productMock ->expects ($ this ->any ())
330
352
->method ('getCartQty ' )
331
353
->will ($ this ->returnValue ($ qty ));
332
354
$ this ->productMock ->expects ($ this ->any ())
333
355
->method ('getStickWithinParent ' )
334
356
->will ($ this ->returnValue (false ));
357
+ $ this ->productMock ->expects ($ this ->once ())
358
+ ->method ('getFinalPrice ' )
359
+ ->will ($ this ->returnValue ($ finalPrice ));
335
360
336
361
$ this ->itemMock ->expects ($ this ->once ())
337
362
->method ('addQty ' )
@@ -341,6 +366,9 @@ public function testPrepareWithResetCountAndNotStickAndOtherItemId()
341
366
->will ($ this ->returnValue ($ itemId ));
342
367
$ this ->itemMock ->expects ($ this ->never ())
343
368
->method ('setData ' );
369
+ $ this ->itemMock ->expects ($ this ->once ())
370
+ ->method ('setPrice ' )
371
+ ->will ($ this ->returnValue ($ this ->itemMock ));
344
372
345
373
$ this ->objectMock ->expects ($ this ->any ())
346
374
->method ('getCustomPrice ' )
@@ -368,6 +396,7 @@ public function testPrepareWithResetCountAndNotStickAndSameItemId()
368
396
$ customPrice = 400000000 ;
369
397
$ itemId = 1 ;
370
398
$ requestItemId = 1 ;
399
+ $ finalPrice = 1000000000 ;
371
400
372
401
$ this ->objectMock ->expects ($ this ->any ())
373
402
->method ('getResetCount ' )
@@ -386,10 +415,16 @@ public function testPrepareWithResetCountAndNotStickAndSameItemId()
386
415
$ this ->productMock ->expects ($ this ->any ())
387
416
->method ('getStickWithinParent ' )
388
417
->will ($ this ->returnValue (false ));
418
+ $ this ->productMock ->expects ($ this ->once ())
419
+ ->method ('getFinalPrice ' )
420
+ ->will ($ this ->returnValue ($ finalPrice ));
389
421
390
422
$ this ->itemMock ->expects ($ this ->once ())
391
423
->method ('addQty ' )
392
424
->with ($ qty );
425
+ $ this ->itemMock ->expects ($ this ->once ())
426
+ ->method ('setPrice ' )
427
+ ->will ($ this ->returnValue ($ this ->itemMock ));
393
428
394
429
$ this ->objectMock ->expects ($ this ->any ())
395
430
->method ('getCustomPrice ' )
0 commit comments