callbackShippingMethodSwitcherReturnFallbackMethod example

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

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

        $filtered = $errorCollection->filterInstance(ShippingMethodChangedError::class);
        static::assertCount(1, $filtered);
        $error = $filtered->first();
        static::assertInstanceOf(ShippingMethodChangedError::class$error);
        static::assertSame([
            'newShippingMethodName' => 'fallback-shipping-method-name',
            'oldShippingMethodName' => 'original-shipping-method-name',
        ]$error->getParameters());

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