finishFrw example

$trackingEventClient = $this->createMock(TrackingEventClient::class);
        $trackingEventClient->expects(static::never())
            ->method('fireTrackingEvent');

        $systemConfigService = new StaticSystemConfigService();
        $frwService = $this->createFirstRunWizardService(
            systemConfigService: $systemConfigService,
            eventDispatcher: $eventDispatcher,
            trackingEventClient: $trackingEventClient,
        );

        $frwService->finishFrw(true, $this->context);

        static::assertSame(1, $systemConfigService->get('core.frw.failureCount'));
    }

    public function testUpdatesFrwStateToCompletedOnFrwFinishWithTrackingEvent(): void
    {
        $eventDispatcher = $this->createMock(EventDispatcherInterface::class);
        $eventDispatcher->expects(static::once())
            ->method('dispatch')
            ->with(static::isInstanceOf(FirstRunWizardFinishedEvent::class));

        
 catch (ClientException $exception) {
            throw new StoreApiException($exception);
        }

        return new JsonResponse(['data' => $domainStruct]);
    }

    #[Route(path: '/api/_action/store/frw/finish', name: 'api.custom.store.frw.finish', methods: ['POST'])]     public function frwFinish(QueryDataBag $params, Context $context): JsonResponse
    {
        $failed = $params->getBoolean('failed');
        $this->frwService->finishFrw($failed$context);

        try {
            $this->frwService->upgradeAccessToken($context);
        } catch (\Exception) {
        }

        return new JsonResponse();
    }
}
Home | Imprint | This part of the site doesn't use cookies.