@@ -363,6 +363,13 @@ private function getQuote(string $reservedOrderId): Quote
363363 public function testDiscountOnSimpleProductWithDiscardSubsequentRule (): void
364364 {
365365 $ cartId = (int )$ this ->fixtures ->get ('cart ' )->getId ();
366+ $ rule1Id = (int )$ this ->fixtures ->get ('rule1 ' )->getId ();
367+ $ rule2Id = (int )$ this ->fixtures ->get ('rule2 ' )->getId ();
368+ $ rule3Id = (int )$ this ->fixtures ->get ('rule3 ' )->getId ();
369+ $ product1Id = (int ) $ this ->fixtures ->get ('p1 ' )->getId ();
370+ $ product2Id = (int ) $ this ->fixtures ->get ('p2 ' )->getId ();
371+ $ product3Id = (int ) $ this ->fixtures ->get ('p3 ' )->getId ();
372+ $ product4Id = (int ) $ this ->fixtures ->get ('p4 ' )->getId ();
366373 $ quote = $ this ->quote ->get ($ cartId );
367374 $ quote ->setStoreId (1 )->setIsActive (true )->setIsMultiShipping (0 )->setCouponCode ('test ' );
368375 $ address = $ quote ->getShippingAddress ();
@@ -372,5 +379,15 @@ public function testDiscountOnSimpleProductWithDiscardSubsequentRule(): void
372379 $ this ->subtotalCollector ->collect ($ quote , $ this ->shippingAssignment , $ this ->total );
373380 $ this ->discountCollector ->collect ($ quote , $ this ->shippingAssignment , $ this ->total );
374381 $ this ->assertEquals (-32 , $ this ->total ->getDiscountAmount ());
382+ $ items = [];
383+ foreach ($ quote ->getAllItems () as $ item ) {
384+ $ items [$ item ->getProductId ()] = $ item ;
385+ }
386+ $ this ->assertEqualsCanonicalizing ([$ rule1Id ,$ rule2Id ,$ rule3Id ], explode (', ' , $ quote ->getAppliedRuleIds ()));
387+ $ this ->assertEqualsCanonicalizing ([$ rule1Id ,$ rule2Id ,$ rule3Id ], explode (', ' , $ address ->getAppliedRuleIds ()));
388+ $ this ->assertEqualsCanonicalizing ([$ rule1Id ], explode (', ' , $ items [$ product1Id ]->getAppliedRuleIds ()));
389+ $ this ->assertEqualsCanonicalizing ([$ rule1Id ,$ rule2Id ], explode (', ' , $ items [$ product2Id ]->getAppliedRuleIds ()));
390+ $ this ->assertEqualsCanonicalizing ([$ rule2Id ], explode (', ' , $ items [$ product3Id ]->getAppliedRuleIds ()));
391+ $ this ->assertEqualsCanonicalizing ([$ rule3Id ], explode (', ' , $ items [$ product4Id ]->getAppliedRuleIds ()));
375392 }
376393}
0 commit comments