// create our group with our price rule
// and use it to match both our products
$group =
$this->
buildGroup( self::KEY_PACKAGER_COUNT,
1,
self::KEY_SORTER_PRICE_ASC,
new RuleCollection([$ruleEntity]) );
$matcher =
new AnyRuleMatcher(new AnyRuleLineItemMatcher());
$matchedItems =
$matcher->
getMatchingItems($group,
new LineItemFlatCollection([$productLower50,
$product50]),
$this->context
);
static::
assertCount(1,
$matchedItems);
static::
assertSame($product50,
$matchedItems->
getElements()[0
]);
} /**
* This test verifies that our line item matching works correctly with 2 rule combinations.
* We create a group with a rule for minimum item price of 50 and minimum quantity of 3.
* We have 4 combinations within our products. The multi rules work with a OR condition, so we
* should get 3 out of our 4 products that match. Only the product with neither quantity nor price condition
* should not match our group rules.
*
* @group lineitemgroup
*/