$this->
createTestFixturePercentagePromotion($promotionId,
$code,
$percentage,
$maxValueGlobal,
$this->
getContainer(), PromotionDiscountEntity::SCOPE_DELIVERY
);
$cart =
$this->cartService->
getCart($this->context->
getToken(),
$this->context
);
// create product and add to cart
$cart =
$this->
addProduct($productId, 1,
$cart,
$this->cartService,
$this->context
);
// create promotion and add to cart
$cart =
$this->
addPromotionCode($code,
$cart,
$this->cartService,
$this->context
);
static::
assertEquals($expectedPrice,
$cart->
getDeliveries()->
getShippingCosts()->
sum()->
getTotalPrice());
static::
assertEquals($expectedTotal,
$cart->
getPrice()->
getTotalPrice());
static::
assertEquals(2,
$cart->
getLineItems()->
count());
static::
assertEquals(2,
$cart->
getDeliveries()->
count());
} /**
* This test verifies that we use the max value of our currency
* instead of the global max value, if existing.
* Thus we create a promotion with 50% for a 100 EUR price.
* That would lead to 50 EUR for shipping costs, which we avoid by setting
* a max global threshold of 40 EUR.
* But for your currency, we use 30 EUR instead.
* Our test needs to verify that we use 30 EUR, and end with a product sum of 70 EUR in the end.
*
* @group promotions
*/