$token =
$this->ids->
create('token'
);
$salesChannelContextService =
$this->
getContainer()->
get(SalesChannelContextService::
class);
$context =
$salesChannelContextService->
get(new SalesChannelContextServiceParameters(TestDefaults::SALES_CHANNEL,
$token, null, Defaults::CURRENCY
));
$cartService =
$this->
getContainer()->
get(CartService::
class);
$cart =
$cartService->
getCart($token,
$context);
$product =
$this->
getContainer()->
get(ProductLineItemFactory::
class) ->
create(['id' =>
$this->ids->
get('product'
), 'referencedId' =>
$this->ids->
get('product'
)],
$context);
$cartService->
add($cart,
$product,
$context);
$productCartProcessor =
$this->
getContainer()->
get(ProductCartProcessor::
class);
$productCartProcessor->
collect( new CartDataCollection(),
$cart,
$context,
new CartBehavior() );
$lineItem =
$cart->
get($product->
getId());
static::
assertInstanceOf(LineItem::
class,
$lineItem);
$payload =
$lineItem->
getPayload();
$purchasePrices =
json_decode((string) $payload['purchasePrices'
], true, 512, \JSON_THROW_ON_ERROR
);
static::
assertSame(Defaults::CURRENCY,
$purchasePrices['currencyId'
]);