QueryDataBag example

use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;

#[Package('core')] class QueryDataBagResolver implements ValueResolverInterface
{
    public function resolve(Request $request, ArgumentMetadata $argument): \Generator
    {
        if ($argument->getType() !== QueryDataBag::class) {
            return;
        }

        yield new QueryDataBag($request->query->all());
    }
}
        $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(
            $shopUserToken,
            
public function testVerifyDomain(): void
    {
        $this->firstRunWizardService->expects(static::once())
            ->method('verifyLicenseDomain');

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

        $response = $frwController->verifyDomain(new QueryDataBag([
            'domain' => 'test-domain.com',
            'testEnvironment' => 'false',
        ])$this->createContext());
        $responseData = $this->decodeJsonResponse($response);

        static::assertArrayHasKey('data', $responseData);
    }

    public function testVerifyDomainWithoutDomain(): void
    {
        $this->firstRunWizardService->expects(static::once())
            
$data->add(['redirectTo' => 'frontend.checkout.confirm.page']);

        $request = $this->createRequest();

        /** @var CustomerDoubleOptInRegistrationEvent $event */
        $event = null;
        $this->catchEvent(CustomerDoubleOptInRegistrationEvent::class$event);

        $registerController->register($request$data$this->salesChannelContext);

        $customer = $customerRepository->search(new Criteria([$event->getCustomer()->getId()])$this->salesChannelContext->getContext());
        $queryData = new QueryDataBag();
        $queryData->set('redirectTo', 'frontend.checkout.confirm.page');
        $queryData->set('hash', $customer->first()->getHash());
        $queryData->set('em', hash('sha1', (string) $event->getCustomer()->getEmail()));

        /** @var RedirectResponse $response */
        $response = $registerController->confirmRegistration($this->salesChannelContext, $queryData);

        static::assertEquals(302, $response->getStatusCode());
        static::assertInstanceOf(RedirectResponse::class$response);
        static::assertEquals('/checkout/confirm', $response->getTargetUrl());
    }

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