$currencyFactor =
random_int(0,
mt_getrandmax()) /
mt_getrandmax();
$builder =
new PromotionItemBuilder();
$discount =
new PromotionDiscountEntity();
$discount->
setId('D5'
);
$discount->
setType(PromotionDiscountEntity::TYPE_PERCENTAGE
);
$discount->
setValue(50
);
$discount->
setScope(PromotionDiscountEntity::SCOPE_CART
);
$item =
$builder->
buildDiscountLineItem('',
$this->promotion,
$discount, 'C1',
$currencyFactor);
static::
assertEquals(PromotionProcessor::LINE_ITEM_TYPE,
$item->
getType());
} /**
* This test verifies that we always use the id of the
* discount and not from the promotion for the item key.
* If we have multiple discounts in a single promotion and use the promotion
* id for the key, then we get duplicate key entries which leads to
* errors like "line item not stackable".
*
* @group promotions
*
* @throws CartException
* @throws UnknownPromotionDiscountTypeException
*/