getStorefrontRequest example

/** @var OrderRouteRequestEvent|null $orderRequestEvent */
        $orderRequestEvent = null;
        $this->catchEvent(OrderRouteRequestEvent::class$orderRequestEvent);

        $page = $this->getPageLoader()->load($request$context);

        static::assertInstanceOf(AccountOrderDetailPage::class$page);
        static::assertSame($orderId$page->getOrder()->getId());
        self::assertPageEvent(AccountOrderDetailPageLoadedEvent::class$accountOrderDetailEvent$context$request$page);

        static::assertNotNull($orderRequestEvent);
        static::assertSame($request$orderRequestEvent->getStorefrontRequest());
        static::assertSame($context$orderRequestEvent->getSalesChannelContext());
        static::assertSame($context->getContext()$orderRequestEvent->getContext());
    }

    public function testMissingOrderIdThrowsException(): void
    {
        $request = new Request();
        $context = $this->createSalesChannelContextWithLoggedInCustomerAndWithNavigation();

        $this->expectException(RoutingException::class);
        $this->getPageLoader()->load($request$context);
    }
Home | Imprint | This part of the site doesn't use cookies.