CodeExplorer translatorCallback example
$request =
new Request([],
['lineItems' =>
[$productId =>
$lineItemData]]);
$cart =
new Cart(Uuid::
randomHex());
$context =
$this->
createMock(SalesChannelContext::
class);
$expectedLineItem =
new LineItem($productId, 'product'
);
$this->lineItemRegistryMock->
expects(static::
once()) ->
method('create'
) ->
with($expectedLineItemData,
$this->
createMock(SalesChannelContext::
class)) ->
willReturn($expectedLineItem);
$this->
translatorCallback();
$this->controller->
addLineItems($cart,
new RequestDataBag($request->request->
all()),
$request,
$context);
} public function testAddLineItemsCallsLineItemSetDefaultValues(): void
{ $productId = Uuid::
randomHex();
$productId2 = Uuid::
randomHex();
$lineItemData =
[ 'id' =>
$productId,
'referencedId' =>
$productId,