$context =
$this->
getContainer()->
get(SalesChannelContextFactory::
class)->
create(Uuid::
randomHex(), TestDefaults::SALES_CHANNEL
);
// add a new sample product
$this->
createTestFixtureProduct($productId, 29, 17,
$this->
getContainer(),
$context);
// add a new promotion black friday
$this->
createTestFixturePercentagePromotion($promotionId,
$code, 100, null,
$this->
getContainer());
$cart =
$this->cartService->
getCart($context->
getToken(),
$context);
// create product and add to cart
$cart =
$this->
addProduct($productId, 1,
$cart,
$this->cartService,
$context);
// create promotion and add to cart
$cart =
$this->
addPromotionCode($code,
$cart,
$this->cartService,
$context);
static::
assertEquals(0.0,
$cart->
getPrice()->
getPositionPrice(), 'Position Total Price has to be 0,00'
);
static::
assertEquals(0.0,
$cart->
getPrice()->
getTotalPrice(), 'Total Price has to be 0,00'
);
static::
assertEquals(0.0,
$cart->
getPrice()->
getCalculatedTaxes()->
getAmount(), 'Taxes have to be 0,00'
);
static::
assertEquals(0.0,
$cart->
getPrice()->
getNetPrice(), 'Net Price has to be 0,00'
);
} /**
* This test verifies that our promotion components are really involved in our checkout.
* We add a product to the cart and apply a code for a promotion with 50% discount.
* Our cart should have a total value of 15,00 in the end.
*
* @group promotions
*
* @throws CartException
*/