$cart =
new Cart('foo'
);
$cart->
setLineItems( new LineItemCollection([ $matchingLineItem,
(new LineItem(Uuid::
randomHex(), LineItem::PRODUCT_LINE_ITEM_TYPE, Uuid::
randomHex()))->
setStackable(true
),
]) );
$priceDefinition =
new AbsolutePriceDefinition(42,
new LineItemRule(Rule::OPERATOR_EQ,
[$matchingLineItem->
getReferencedId() ?? ''
]));
$discount =
new DiscountLineItem('foo',
$priceDefinition,
['discountScope' => 'foo', 'discountType' => 'bar'
], null
);
$packager =
new CartScopeDiscountPackager();
$items =
$packager->
getMatchingItems($discount,
$cart,
$context);
$expected =
new DiscountPackageCollection([ new DiscountPackage( new LineItemQuantityCollection([ new LineItemQuantity($matchingLineItem->
getId(), 1
),
new LineItemQuantity($matchingLineItem->
getId(), 1
),
]) ),
]);