offcanvas example

$assertResponse = new Response(null, Response::HTTP_NO_CONTENT);

        static::assertEquals($assertResponse$response);
    }

    public function testOffCanvas(): void
    {
        $request = new Request();

        $context = $this->createMock(SalesChannelContext::class);

        $response = $this->controller->offcanvas($request$context);

        static::assertEquals(new Response()$response);
    }

    public function testOffCanvasRedirectOnShippingErrors(): void
    {
        $cart = new Cart(Uuid::randomHex());
        $cart->add(new LineItem(Uuid::randomHex(), LineItem::PRODUCT_LINE_ITEM_TYPE));
        $cart->addErrors(new ShippingMethodChangedError('old', 'new'));

        $context = $this->createMock(SalesChannelContext::class);
        


    public function testCheckoutOffcanvasWidgetLoadedHookScriptsAreExecuted(): void
    {
        $contextToken = Uuid::randomHex();

        $this->fillCart($contextToken);

        $salesChannelContext = $this->createSalesChannelContext($contextToken);
        $request = $this->createRequest($salesChannelContext);

        $this->getContainer()->get(CheckoutController::class)->offcanvas($request$salesChannelContext);

        $traces = $this->getContainer()->get(ScriptTraces::class)->getTraces();
        static::assertArrayHasKey(CheckoutOffcanvasWidgetLoadedHook::HOOK_NAME, $traces);
    }

    private function updateSalesChannel(string $salesChannelId): void
    {
        $snippetSetId = $this->getSnippetSetIdForLocale('en-GB');
        $paymentMethodId = $this->getValidPaymentMethodId();
        $shippingMethodId = $this->getValidShippingMethodId();
        $countryId = $this->getValidCountryId();

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