CustomerAccountRecoverRequestEvent example



        $this->customerRecoveryRepository->create([$recoveryData]$repoContext);

        $customerRecovery = $this->customerRecoveryRepository->search($customerIdCriteria$repoContext)->first();
        \assert($customerRecovery instanceof CustomerRecoveryEntity);

        $hash = $customerRecovery->getHash();

        $recoverUrl = $this->getRecoverUrl($context$hash$data->get('storefrontUrl')$customerRecovery);

        $event = new CustomerAccountRecoverRequestEvent($context$customerRecovery$recoverUrl);
        $this->eventDispatcher->dispatch($event, CustomerAccountRecoverRequestEvent::EVENT_NAME);

        return new SuccessResponse();
    }

    private function validateRecoverEmail(DataBag $data, SalesChannelContext $context, bool $validateStorefrontUrl = true): void
    {
        $validation = new DataValidationDefinition('customer.email.recover');

        $validation
            ->add(
                

class CustomerAccountRecoverRequestEventTest extends TestCase
{
    public function testRestoreScalarValuesCorrectly(): void
    {
        $salesChannel = new SalesChannelEntity();
        $salesChannel->setTranslated(['name' => 'my-shop-name']);

        $context = $this->createMock(SalesChannelContext::class);
        $context->expects(static::any())->method('getSalesChannel')->willReturn($salesChannel);

        $event = new CustomerAccountRecoverRequestEvent(
            $context,
            new CustomerRecoveryEntity(),
            'my-reset-url'
        );

        $storer = new ScalarValuesStorer();

        $stored = $storer->store($event[]);

        $flow = new StorableFlow('foo', Context::createDefaultContext()$stored);

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