// add a new sample product
$this->
createTestFixtureProduct($productId, 60, 17,
$this->
getContainer(),
$this->context
);
// add a new promotion black friday
$this->
createTestFixtureDeliveryPromotion($promotionId, PromotionDiscountEntity::TYPE_ABSOLUTE, 10,
$this->
getContainer(),
$this->context,
$code);
$cart =
$this->cartService->
getCart($this->token,
$this->context
);
// create product and add to cart
$cart =
$this->
addProduct($productId, 2,
$cart,
$this->cartService,
$this->context
);
static::
assertEquals(100,
$cart->
getShippingCosts()->
getTotalPrice(), 'Delivery costs should be 100 in the beginning'
);
// create promotion and add to cart
$cart =
$this->
addPromotionCode($code,
$cart,
$this->cartService,
$this->context
);
static::
assertEquals(90,
$cart->
getShippingCosts()->
getTotalPrice());
static::
assertEquals(2,
$cart->
getDeliveries()->
count());
} /**
* This test verifies that our percentage promotions are correctly added.
* We add a product and also an percentage promotion.
* Our final delivery price should then be as expected.
*
* @group promotions
*
* @throws CartException
*/