fireTrackingEvent example

private readonly FilesystemOperator $filesystem,
        private readonly bool $frwAutoRun,
        private readonly EventDispatcherInterface $eventDispatcher,
        private readonly FirstRunWizardClient $frwClient,
        private readonly EntityRepository $userConfigRepository,
        private readonly TrackingEventClient $trackingEventClient
    ) {
    }

    public function startFrw(Context $context): void
    {
        $this->trackingEventClient->fireTrackingEvent(self::TRACKING_EVENT_FRW_STARTED);

        $this->eventDispatcher->dispatch(new FirstRunWizardStartedEvent($this->getFrwState()$context));
    }

    public function frwLogin(string $shopwareId, string $password, Context $context): void
    {
        $accessTokenResponse = $this->frwClient->frwLogin($shopwareId$password$context);
        $accessToken = $this->createAccessTokenStruct($accessTokenResponse$accessTokenResponse['firstRunWizardUserToken']);

        $this->updateFrwUserToken($context$accessToken);
    }

    
$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
    {
        $mockHandler = new MockHandler();
        $mockHandler->append(new Response(200));
        $httpClient = new Client(['handler' => HandlerStack::create($mockHandler)]);

        
Home | Imprint | This part of the site doesn't use cookies.