callbackShippingMethodSwitcherReturnOriginalMethod example

->method('assign')
            ->willReturnCallback(
                function D$newMethods): void {
                    $paymentMethod = $newMethods['paymentMethod'];
                    static::assertInstanceOf(PaymentMethodEntity::class$paymentMethod);
                    static::assertSame('fallback-payment-method-name', $paymentMethod->getName());
                }
            );

        $cartFacade = $this->getStorefrontCartFacade(
            $cart,
            $this->callbackShippingMethodSwitcherReturnOriginalMethod(...),
            $this->callbackPaymentMethodSwitcherReturnFallbackMethod(...)
        );
        $returnedCart = $cartFacade->get('', $salesChannelContext);

        $filtered = $errorCollection->filterInstance(PaymentMethodChangedError::class);
        static::assertCount(1, $filtered);
        $error = $filtered->first();
        static::assertInstanceOf(PaymentMethodChangedError::class$error);
        static::assertSame([
            'newPaymentMethodName' => 'fallback-payment-method-name',
            'oldPaymentMethodName' => 'original-payment-method-name',
        ],
Home | Imprint | This part of the site doesn't use cookies.