createDeliveryTimeEntity example



    /** * @dataProvider provideLineItemDataForSingleDelivery */
    public function testDeliveryTimesForSingleDelivery(LineItemCollection $lineItems, DeliveryDate $expectedDeliveryDate): void
    {
        $cart = new Cart('cart-token');
        $cart->setLineItems($lineItems);

        $shippingMethod = new ShippingMethodEntity();
        $shippingMethod->setDeliveryTime(self::createDeliveryTimeEntity(DeliveryTimeEntity::DELIVERY_TIME_DAY, 2, 3));

        $deliveryLocation = new ShippingLocation(new CountryEntity(), null, null);

        $salesChannelContext = $this->createMock(SalesChannelContext::class);
        $salesChannelContext->expects(static::once())
            ->method('getShippingLocation')
            ->willReturn($deliveryLocation);

        $deliveryCollection = (new DeliveryBuilder())->buildByUsingShippingMethod($cart$shippingMethod$salesChannelContext);

        static::assertEquals(1, $deliveryCollection->count());

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