@@ -117,11 +117,6 @@ protected function setUp(): void
117
117
->getMock ();
118
118
$ this ->rule = $ this ->getMockBuilder (Rule::class)
119
119
->disableOriginalConstructor ()
120
- ->addMethods (
121
- [
122
- 'getSimpleAction '
123
- ]
124
- )
125
120
->getMock ();
126
121
$ this ->eventManagerMock = $ this ->createMock (Manager::class);
127
122
$ priceCurrencyMock = $ this ->getMockForAbstractClass (PriceCurrencyInterface::class);
@@ -219,7 +214,15 @@ public function testCollectItemNoDiscount()
219
214
$ this ->shippingAssignmentMock ->expects ($ this ->any ())->method ('getItems ' )->willReturn ([$ itemNoDiscount ]);
220
215
$ this ->addressMock ->expects ($ this ->any ())->method ('getShippingAmount ' )->willReturn (true );
221
216
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 );
223
226
224
227
$ this ->assertInstanceOf (
225
228
Discount::class,
@@ -265,7 +268,15 @@ public function testCollectItemHasParent()
265
268
$ this ->addressMock ->expects ($ this ->any ())->method ('getQuote ' )->willReturn ($ quoteMock );
266
269
$ this ->addressMock ->expects ($ this ->any ())->method ('getShippingAmount ' )->willReturn (true );
267
270
$ 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 );
269
280
270
281
$ this ->assertInstanceOf (
271
282
Discount::class,
@@ -334,7 +345,16 @@ public function testCollectItemHasNoChildren()
334
345
$ this ->addressMock ->expects ($ this ->any ())->method ('getShippingAmount ' )->willReturn (true );
335
346
$ this ->shippingAssignmentMock ->expects ($ this ->any ())->method ('getItems ' )->willReturn ([$ itemWithChildren ]);
336
347
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
+
338
358
$ this ->assertInstanceOf (
339
359
Discount::class,
340
360
$ this ->discount ->collect ($ quoteMock , $ this ->shippingAssignmentMock , $ totalMock )
@@ -353,10 +373,11 @@ public function testFetch()
353
373
354
374
$ quoteMock = $ this ->createMock (Quote::class);
355
375
$ totalMock = $ this ->getMockBuilder (Total::class)
356
- ->addMethods (['getDiscountAmount ' , 'getDiscountDescription ' ])
376
+ ->addMethods (['getDiscountAmount ' , 'getDiscountDescription ' , ' getBaseDiscountAmount ' ])
357
377
->disableOriginalConstructor ()
358
378
->getMock ();
359
379
380
+ $ totalMock ->expects ($ this ->any ())->method ('getBaseDiscountAmount ' )->willReturn (0.0 );
360
381
$ totalMock ->expects ($ this ->once ())->method ('getDiscountAmount ' )->willReturn ($ discountAmount );
361
382
$ totalMock ->expects ($ this ->once ())->method ('getDiscountDescription ' )->willReturn ($ discountDescription );
362
383
$ this ->assertEquals ($ expectedResult , $ this ->discount ->fetch ($ quoteMock , $ totalMock ));
0 commit comments