static::
assertInstanceOf(AndRule::
class,
$filterRule);
static::
assertInstanceOf(PromotionCodeOfTypeRule::
class,
$filterRule->
getRules()[0
]);
} public function testFilter(): void
{ $item =
$this->
createLineItemWithPrice(LineItem::PROMOTION_LINE_ITEM_TYPE, -40
)->
setPayloadValue('promotionCodeType', 'fixed'
);
$item2 =
$this->
createLineItemWithPrice(LineItem::PROMOTION_LINE_ITEM_TYPE, -100
)->
setPayloadValue('promotionCodeType', 'global'
);
$cart =
$this->
createCart(new LineItemCollection([$item,
$item2]));
$this->
assertRuleMatches($cart);
} public function testFilterNested(): void
{ $item =
$this->
createLineItemWithPrice(LineItem::PROMOTION_LINE_ITEM_TYPE, -40
)->
setPayloadValue('promotionCodeType', 'fixed'
);
$item2 =
$this->
createLineItemWithPrice(LineItem::PROMOTION_LINE_ITEM_TYPE, -100
)->
setPayloadValue('promotionCodeType', 'global'
);
$containerLineItem =
$this->
createContainerLineItem(new LineItemCollection([$item,
$item2]));
$cart =
$this->
createCart(new LineItemCollection([$containerLineItem]));
$this->
assertRuleMatches($cart);
}