DoubleOptInGuestOrderEvent example

use Shopware\Core\System\SalesChannel\SalesChannelContext;

/** * @internal * * @covers \Shopware\Core\Checkout\Customer\Event\DoubleOptInGuestOrderEvent */
class DoubleOptInGuestOrderEventTest extends TestCase
{
    public function testScalarValuesCorrectly(): void
    {
        $event = new DoubleOptInGuestOrderEvent(
            new CustomerEntity(),
            $this->createMock(SalesChannelContext::class),
            'my-confirm-url'
        );

        $storer = new ScalarValuesStorer();

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

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

        


    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> */
Home | Imprint | This part of the site doesn't use cookies.