$instanceService =
$this->
createMock(InstanceService::
class);
$instanceService->
method('getShopwareVersion'
)->
willReturn('6.5.0.0-test'
);
$instanceService->
method('getInstanceId'
)->
willReturn('test-instance-id'
);
$trackingEventClient =
new TrackingEventClient($httpClient,
$instanceService);
$trackingEventClient->
fireTrackingEvent('Tracking event fired and returned',
[ 'someAdditionalData' => 'xy',
]);
$lastRequest =
$mockHandler->
getLastRequest();
static::
assertInstanceOf(RequestInterface::
class,
$lastRequest);
static::
assertEquals('/swplatform/tracking/events',
$lastRequest->
getUri()->
getPath());
static::
assertEquals( [ 'instanceId' => 'test-instance-id',
'additionalData' =>
[ 'shopwareVersion' => '6.5.0.0-test',
'someAdditionalData' => 'xy',
],
'event' => 'Tracking event fired and returned',
],
\
json_decode($lastRequest->
getBody()->
getContents(), true, 512, \JSON_THROW_ON_ERROR
) );
}