confirmPage example

$response = $this->controller->cartJson(new Request()$this->createMock(SalesChannelContext::class));

        static::assertEquals(new CartResponse($cart)$response);
    }

    public function testConfirmPageNoCustomer(): void
    {
        $context = $this->createMock(SalesChannelContext::class);
        $context->method('getCustomer')->willReturn(null);

        $response = $this->controller->confirmPage(new Request()$context);

        static::assertEquals(new RedirectResponse('url')$response);
    }

    public function testConfirmPageEmptyCart(): void
    {
        $context = $this->createMock(SalesChannelContext::class);
        $context->method('getCustomer')->willReturn(new CustomerEntity());

        $response = $this->controller->confirmPage(new Request()$context);

        


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

        $this->fillCart($contextToken);

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

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

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

    public function testJsonCart(): void
    {
        $browser = $this->getBrowserWithLoggedInCustomer();
        $browserSalesChannelId = $browser->getServerParameter('test-sales-channel-id');

        $productId = Uuid::randomHex();
        
Home | Imprint | This part of the site doesn't use cookies.