frwFinish example

// Response for request of FirstRunWizardClient::upgradeAccessToken()         $this->getFrwRequestHandler()->append(new Response(
            body: json_encode([
                'shopUserToken' => [
                    'token' => $shopUserToken,
                    'expirationDate' => (new \DateTimeImmutable('2022-12-15'))->format(Defaults::STORAGE_DATE_FORMAT),
                ],
                'shopSecret' => $shopSecret,
            ], \JSON_THROW_ON_ERROR),
        ));

        $this->frwController->frwFinish(
            new QueryDataBag([
                'failed' => false,
            ]),
            $context
        );

        static::assertInstanceOf(FirstRunWizardFinishedEvent::class$dispatchedEvent);
        static::assertNull(
            $this->fetchUserConfig(FirstRunWizardService::USER_CONFIG_KEY_FRW_USER_TOKEN, FirstRunWizardService::USER_CONFIG_VALUE_FRW_USER_TOKEN)
        );
        static::assertEquals(
            
$this->firstRunWizardService->expects(static::once())
            ->method('finishFrw');
        $this->firstRunWizardService->expects(static::once())
            ->method('upgradeAccessToken');

        $frwController = new FirstRunWizardController(
            $this->firstRunWizardService,
            new StaticEntityRepository([]),
            new StaticEntityRepository([]),
        );

        $response = $frwController->frwFinish(new QueryDataBag(['failed' => 'true'])$this->createContext());

        static::assertEquals(SymfonyResponse::HTTP_OK, $response->getStatusCode());
    }

    public function testFinishFrwWithoutFailedParam(): void
    {
        $this->firstRunWizardService->expects(static::once())
            ->method('finishFrw');
        $this->firstRunWizardService->expects(static::once())
            ->method('upgradeAccessToken');

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