@@ -346,11 +346,14 @@ public function testInitTotalsCanApplyDiscount()
346
346
'getDiscountCalculationPrice ' ,
347
347
'getBaseDiscountCalculationPrice ' ,
348
348
'getCalculationPrice ' ,
349
- 'getParentItemId '
349
+ 'getParentItemId ' ,
350
+ 'getParentItem '
350
351
]
351
352
);
352
353
$ item2 = clone $ item1 ;
353
- $ items = [$ item1 , $ item2 ];
354
+ $ item3 = clone $ item1 ;
355
+ $ item4 = clone $ item1 ;
356
+ $ items = [$ item1 , $ item2 , $ item3 , $ item4 ];
354
357
355
358
$ rule ->expects ($ this ->any ())
356
359
->method ('getSimpleAction ' )
@@ -368,11 +371,21 @@ public function testInitTotalsCanApplyDiscount()
368
371
$ validator ->expects ($ this ->at (1 ))->method ('isValid ' )->with ($ item2 )->willReturn (true );
369
372
370
373
$ item1 ->expects ($ this ->any ())->method ('getParentItemId ' )->willReturn (false );
374
+ $ item1 ->expects ($ this ->any ())->method ('getParentItem ' )->willReturn (false );
371
375
$ item1 ->expects ($ this ->never ())->method ('getDiscountCalculationPrice ' );
372
376
$ item1 ->expects ($ this ->never ())->method ('getBaseDiscountCalculationPrice ' );
373
377
$ item2 ->expects ($ this ->any ())->method ('getParentItemId ' )->willReturn (false );
378
+ $ item2 ->expects ($ this ->any ())->method ('getParentItem ' )->willReturn (false );
374
379
$ item2 ->expects ($ this ->any ())->method ('getDiscountCalculationPrice ' )->willReturn (50 );
375
380
$ item2 ->expects ($ this ->once ())->method ('getBaseDiscountCalculationPrice ' )->willReturn (50 );
381
+ $ item3 ->expects ($ this ->any ())->method ('getParentItemId ' )->willReturn (false );
382
+ $ item3 ->expects ($ this ->any ())->method ('getParentItem ' )->willReturn (true );
383
+ $ item3 ->expects ($ this ->never ())->method ('getDiscountCalculationPrice ' );
384
+ $ item3 ->expects ($ this ->never ())->method ('getBaseDiscountCalculationPrice ' );
385
+ $ item4 ->expects ($ this ->any ())->method ('getParentItemId ' )->willReturn (true );
386
+ $ item4 ->expects ($ this ->any ())->method ('getParentItem ' )->willReturn (false );
387
+ $ item4 ->expects ($ this ->never ())->method ('getDiscountCalculationPrice ' );
388
+ $ item4 ->expects ($ this ->never ())->method ('getBaseDiscountCalculationPrice ' );
376
389
$ this ->utility ->expects ($ this ->once ())->method ('getItemQty ' )->willReturn (1 );
377
390
$ this ->utility ->expects ($ this ->any ())->method ('canProcessRule ' )->willReturn (true );
378
391
0 commit comments