buildOrderLineItemEntity example



    public function testTransformFlatToNested(): void
    {
        $containerId = Uuid::randomHex();
        $productId = Uuid::randomHex();
        $optionOneId = Uuid::randomHex();
        $optionTwoId = Uuid::randomHex();

        $orderLineItemCollection = new OrderLineItemCollection(
            [
                $this->buildOrderLineItemEntity($containerId, LineItem::CUSTOM_LINE_ITEM_TYPE, null, 3),
                $this->buildOrderLineItemEntity($productId, LineItem::PRODUCT_LINE_ITEM_TYPE, $containerId, 3),
                $this->buildOrderLineItemEntity($optionOneId, LineItem::CUSTOM_LINE_ITEM_TYPE, $containerId, 3),
                $this->buildOrderLineItemEntity($optionTwoId, LineItem::CUSTOM_LINE_ITEM_TYPE, $containerId, 3),
            ]
        );

        $nestedCollection = LineItemTransformer::transformFlatToNested($orderLineItemCollection);
        static::assertCount(1, $nestedCollection);

        $lineItem = $nestedCollection->first();
        static::assertInstanceOf(LineItem::class$lineItem);
        
Home | Imprint | This part of the site doesn't use cookies.