$cart =
$this->cartService->
getCart($this->context->
getToken(),
$this->context
);
// create first product and add to cart
$cart =
$this->
addProduct($productId1, 5,
$cart,
$this->cartService,
$this->context
);
$cart =
$this->
addProduct($productId2, 3,
$cart,
$this->cartService,
$this->context
);
// create promotion and add to cart
$cart =
$this->
addPromotionCode($code,
$cart,
$this->cartService,
$this->context
);
/** @var CalculatedPrice $discountPrice */
$discountPrice =
$cart->
getLineItems()->
getFlat()[2
]->
getPrice();
/** @var CalculatedTax $tax1 */
$tax1 =
$discountPrice->
getCalculatedTaxes()->
getElements()[19
]->
getTax();
$tax2 =
$discountPrice->
getCalculatedTaxes()->
getElements()[7
]->
getTax();
// our correct values are based on a distribution of 2 + 3 instead of 5 + 3
static::
assertEquals(-24.4,
$tax1);
static::
assertEquals(-13.49,
$tax2);
}