$discountItems =
new LineItemCollection([$discountItem]);
$original =
new Cart(Uuid::
randomHex());
$toCalculate =
new Cart(Uuid::
randomHex());
$this->promotionCalculator->
calculate($discountItems,
$original,
$toCalculate,
$this->salesChannelContext,
new CartBehavior());
static::
assertEmpty($toCalculate->
getLineItems());
} public function testCalculateAddsValidPromotionToCalculatedCart(): void
{ $promotionId =
$this->
getPromotionId();
$discountItem =
$this->
getDiscountItem($promotionId);
$discountItems =
new LineItemCollection([$discountItem]);
$original =
new Cart(Uuid::
randomHex());
$productLineItem =
new LineItem(Uuid::
randomHex(), LineItem::PRODUCT_LINE_ITEM_TYPE
);
$productLineItem->
setPrice(new CalculatedPrice(100.0, 100.0,
new CalculatedTaxCollection(),
new TaxRuleCollection()));
$productLineItem->
setStackable(true
);
$toCalculate =
new Cart(Uuid::
randomHex());
$toCalculate->
add($productLineItem);
$toCalculate->
setPrice(new CartPrice(84.03, 100.0, 100.0,
new CalculatedTaxCollection(),
new TaxRuleCollection(), CartPrice::TAX_STATE_GROSS
));