@@ -117,11 +117,6 @@ protected function setUp(): void
117117 ->getMock ();
118118 $ this ->rule = $ this ->getMockBuilder (Rule::class)
119119 ->disableOriginalConstructor ()
120- ->addMethods (
121- [
122- 'getSimpleAction '
123- ]
124- )
125120 ->getMock ();
126121 $ this ->eventManagerMock = $ this ->createMock (Manager::class);
127122 $ priceCurrencyMock = $ this ->getMockForAbstractClass (PriceCurrencyInterface::class);
@@ -219,7 +214,15 @@ public function testCollectItemNoDiscount()
219214 $ this ->shippingAssignmentMock ->expects ($ this ->any ())->method ('getItems ' )->willReturn ([$ itemNoDiscount ]);
220215 $ this ->addressMock ->expects ($ this ->any ())->method ('getShippingAmount ' )->willReturn (true );
221216
222- $ totalMock = $ this ->createMock (Total::class);
217+ $ totalMock = $ this ->getMockBuilder (Total::class)
218+ ->addMethods (
219+ [
220+ 'getBaseDiscountAmount '
221+ ]
222+ )
223+ ->disableOriginalConstructor ()
224+ ->getMock ();
225+ $ totalMock ->expects ($ this ->any ())->method ('getBaseDiscountAmount ' )->willReturn (0.0 );
223226
224227 $ this ->assertInstanceOf (
225228 Discount::class,
@@ -265,7 +268,15 @@ public function testCollectItemHasParent()
265268 $ this ->addressMock ->expects ($ this ->any ())->method ('getQuote ' )->willReturn ($ quoteMock );
266269 $ this ->addressMock ->expects ($ this ->any ())->method ('getShippingAmount ' )->willReturn (true );
267270 $ this ->shippingAssignmentMock ->expects ($ this ->any ())->method ('getItems ' )->willReturn ([$ itemWithParentId ]);
268- $ totalMock = $ this ->createMock (Total::class);
271+ $ totalMock = $ this ->getMockBuilder (Total::class)
272+ ->addMethods (
273+ [
274+ 'getBaseDiscountAmount '
275+ ]
276+ )
277+ ->disableOriginalConstructor ()
278+ ->getMock ();
279+ $ totalMock ->expects ($ this ->any ())->method ('getBaseDiscountAmount ' )->willReturn (0.0 );
269280
270281 $ this ->assertInstanceOf (
271282 Discount::class,
@@ -334,7 +345,16 @@ public function testCollectItemHasNoChildren()
334345 $ this ->addressMock ->expects ($ this ->any ())->method ('getShippingAmount ' )->willReturn (true );
335346 $ this ->shippingAssignmentMock ->expects ($ this ->any ())->method ('getItems ' )->willReturn ([$ itemWithChildren ]);
336347
337- $ totalMock = $ this ->createMock (Total::class);
348+ $ totalMock = $ this ->getMockBuilder (Total::class)
349+ ->addMethods (
350+ [
351+ 'getBaseDiscountAmount '
352+ ]
353+ )
354+ ->disableOriginalConstructor ()
355+ ->getMock ();
356+ $ totalMock ->expects ($ this ->any ())->method ('getBaseDiscountAmount ' )->willReturn (0.0 );
357+
338358 $ this ->assertInstanceOf (
339359 Discount::class,
340360 $ this ->discount ->collect ($ quoteMock , $ this ->shippingAssignmentMock , $ totalMock )
@@ -353,10 +373,11 @@ public function testFetch()
353373
354374 $ quoteMock = $ this ->createMock (Quote::class);
355375 $ totalMock = $ this ->getMockBuilder (Total::class)
356- ->addMethods (['getDiscountAmount ' , 'getDiscountDescription ' ])
376+ ->addMethods (['getDiscountAmount ' , 'getDiscountDescription ' , ' getBaseDiscountAmount ' ])
357377 ->disableOriginalConstructor ()
358378 ->getMock ();
359379
380+ $ totalMock ->expects ($ this ->any ())->method ('getBaseDiscountAmount ' )->willReturn (0.0 );
360381 $ totalMock ->expects ($ this ->once ())->method ('getDiscountAmount ' )->willReturn ($ discountAmount );
361382 $ totalMock ->expects ($ this ->once ())->method ('getDiscountDescription ' )->willReturn ($ discountDescription );
362383 $ this ->assertEquals ($ expectedResult , $ this ->discount ->fetch ($ quoteMock , $ totalMock ));
0 commit comments