CustomerDoubleOptInRegistrationEvent example

private function getDoubleOptInEvent(CustomerEntity $customer, SalesChannelContext $context, string $url, ?string $redirectTo = null): Event
    {
        $url .= $this->getConfirmUrl($context$customer);

        if ($redirectTo) {
            $url .= '&redirectTo=' . $redirectTo;
        }

        if ($customer->getGuest()) {
            $event = new DoubleOptInGuestOrderEvent($customer$context$url);
        } else {
            $event = new CustomerDoubleOptInRegistrationEvent($customer$context$url);
        }

        return $event;
    }

    /** * @param array<string, mixed> $customer * * @return array<string, mixed> */
    private function addDoubleOptInData(array $customer, SalesChannelContext $context): array
    {
use Shopware\Core\System\SalesChannel\SalesChannelContext;

/** * @internal * * @covers \Shopware\Core\Checkout\Customer\Event\CustomerDoubleOptInRegistrationEvent */
class CustomerDoubleOptInRegistrationEventTest extends TestCase
{
    public function testRestoreScalarValuesCorrectly(): void
    {
        $event = new CustomerDoubleOptInRegistrationEvent(
            new CustomerEntity(),
            $this->createMock(SalesChannelContext::class),
            'my-confirm-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.