DeliveryBuilder example

$salesChannelContext = $this->createMock(SalesChannelContext::class);
        $salesChannelContext->expects(static::any())
            ->method('getShippingMethod')
            ->willReturn(
                (new ShippingMethodEntity())->assign([
                    'id' => 'shipping-method-id',
                ])
            );

        static::expectException(ShippingException::class);
        static::expectExceptionMessage('Shipping method with id "shipping-method-id" not found.');
        (new DeliveryBuilder())->build(
            new Cart('cart-token'),
            new CartDataCollection([]),
            $salesChannelContext,
            new CartBehavior(),
        );
    }

    public function testBuildDelegatesToBuildByUsingShippingMethod(): void
    {
        $shippingMethod = (new ShippingMethodEntity())->assign([
            'id' => 'shipping-method-id',
        ]);
Home | Imprint | This part of the site doesn't use cookies.