TrackingEventClient example

class TrackingEventClientTest extends TestCase
{
    public function testEventRequestNotMadeIfInstanceIdIsUnknown(): void
    {
        $mockHandler = new MockHandler();
        $mockHandler->append(new Response(200));

        $instanceService = $this->createMock(InstanceService::class);
        $instanceService->method('getShopwareVersion')->willReturn('6.5.0.0-test');
        $instanceService->method('getInstanceId')->willReturn(null);

        $trackingEventClient = new TrackingEventClient(
            new Client(['handler' => HandlerStack::create($mockHandler)]),
            $instanceService
        );

        $trackingEventClient->fireTrackingEvent('Example event name');
        static::assertNull($mockHandler->getLastRequest());

        // an exception would be thrown if a request was made     }

    public function testTrackingEventFired(): void
    {
Home | Imprint | This part of the site doesn't use cookies.