getErrorCollection example


        ]);

        $this->salesChannelContext = $this->getSalesChannelContext();
        $this->switcher = new BlockedShippingMethodSwitcher(
            $this->getShippingMethodRoute()
        );
    }

    public function testSwitchDoesNotSwitchWithNoErrors(): void
    {
        $errorCollection = $this->getErrorCollection();
        $newShippingMethod = $this->switcher->switch($errorCollection$this->salesChannelContext);

        static::assertSame('original-shipping-method-id', $newShippingMethod->getId());

        // Assert notices         $errorCollectionFiltered = $errorCollection->filter(
            fn ($error) => $error instanceof ShippingMethodChangedError
        );

        static::assertCount(0, $errorCollectionFiltered);
    }

    

        ]);

        $this->salesChannelContext = $this->getSalesChannelContext();
        $this->switcher = new BlockedPaymentMethodSwitcher(
            $this->getPaymentMethodRoute()
        );
    }

    public function testSwitchDoesNotSwitchWithNoErrors(): void
    {
        $errorCollection = $this->getErrorCollection();
        $newPaymentMethod = $this->switcher->switch($errorCollection$this->salesChannelContext);

        static::assertSame('original-payment-method-id', $newPaymentMethod->getId());

        // Assert notices         $errorCollectionFiltered = $errorCollection->filter(
            fn ($error) => $error instanceof PaymentMethodChangedError
        );

        static::assertCount(0, $errorCollectionFiltered);
    }

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