createOrderTransaction example

/** * @dataProvider dataProviderActions * * @param array<string, string> $path */
    public function testAction(array $path): void
    {
        $context = Context::createDefaultContext();
        $customerId = $this->createCustomer($context);
        $orderId = $this->createOrder($customerId$context);
        $transactionId = $this->createOrderTransaction($orderId$context);

        foreach ($path as $action => $destinationState) {
            $this->orderTransactionStateHelper->$action($transactionId$context); /* @phpstan-ignore-line */

            $criteria = new Criteria([$transactionId]);
            $criteria->addAssociation('stateMachineState');

            /** @var OrderTransactionEntity|null $transaction */
            $transaction = $this->orderTransactionRepository->search($criteria$context)->first();

            static::assertSame($destinationState$transaction?->getStateMachineState()?->getTechnicalName());
        }
Home | Imprint | This part of the site doesn't use cookies.