getOrderFixture example

protected function setUp(): void
    {
        $this->orderRepository = $this->getContainer()->get('order.repository');
        $this->context = Context::createDefaultContext();
    }

    public function testCustomFieldOrderVersioning(): void
    {
        $id = Uuid::randomHex();
        $versionId = $this->context->getVersionId();

        $order = $this->getOrderFixture($id$versionId);

        // create order + order version and belonging context         $this->orderRepository->create([$order]$this->context);
        $versionedOrderId = $this->orderRepository->createVersion($id$this->context);
        $versionedContext = $this->context->createWithVersionId($versionedOrderId);

        /** @var OrderEntity $order */
        $order = $this->orderRepository->search(new Criteria([$id])$this->context)->first();

        /** @var OrderEntity $versionedOrder */
        $versionedOrder = $this->orderRepository->search(new Criteria([$id])$versionedContext)->first();

        
'id' => $this->ids->get('g'),
                'name' => 'bar',
                'products' => [
                    ['id' => $this->ids->get('p1')],
                    ['id' => $this->ids->get('p3')],
                ],
            ],
        ];

        $this->getContainer()->get('tag.repository')->create($tags$context);

        $order = $this->getOrderFixture($this->ids->get('o1')$context->getVersionId());

        $this->getContainer()->get('order.repository')->create([$order]$context);

        $versionId = $this->getContainer()->get('order.repository')->createVersion(
            $this->ids->get('o1'),
            $context,
            Uuid::randomHex(),
            Uuid::randomHex()
        );

        $versionContext = Context::createDefaultContext()->createWithVersionId($versionId);

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