diff --git a/.gitignore b/.gitignore
index 6772c7d..86f77da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,5 @@ tests/Application/web/*
/etc/build/*
!/etc/build/.gitkeep
+.idea
+package-lock.json
diff --git a/composer.json b/composer.json
index 62e6547..f7ebc0b 100644
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,7 @@
},
"require-dev": {
"behat/behat": "^3.14",
- "behat/mink-selenium2-driver": "^1.6",
+ "behat/mink-selenium2-driver": "1.6.0",
"bitbag/coding-standard": "^3.0",
"dmore/behat-chrome-extension": "^1.4",
"dmore/chrome-mink-driver": "^2.9",
diff --git a/tests/Behat/Context/Setup/RelatedProductsContext.php b/tests/Behat/Context/Setup/RelatedProductsContext.php
index 95ae37f..4131a70 100644
--- a/tests/Behat/Context/Setup/RelatedProductsContext.php
+++ b/tests/Behat/Context/Setup/RelatedProductsContext.php
@@ -14,6 +14,7 @@
use Doctrine\ORM\EntityManagerInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\Core\Model\OrderInterface;
+use Sylius\Component\Core\OrderPaymentStates;
use Sylius\Component\Core\Model\OrderItemInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
@@ -35,6 +36,8 @@ public function __construct(
private readonly FactoryInterface $orderItemFactory,
private readonly FactoryInterface $customerFactory,
private readonly WorkflowInterface $orderWorkflow,
+ private readonly WorkflowInterface $orderPaymentWorkflow,
+ private readonly WorkflowInterface $shipmentWorkflow,
private readonly OrderItemQuantityModifierInterface $itemQuantityModifier,
private readonly EntityManagerInterface $entityManager
) {
@@ -63,9 +66,7 @@ private function createOrdersWithProducts(
for ($i = 0; $i < $numberOfOrders; ++$i) {
$order = $this->createOrder();
-
$this->orderWorkflow->apply($order, OrderTransitions::TRANSITION_CREATE);
-
$this->applyPaymentTransitionOnOrder($order, PaymentTransitions::TRANSITION_COMPLETE);
foreach ($products as $product) {
@@ -119,8 +120,7 @@ private function createCustomer(): CustomerInterface
private function applyPaymentTransitionOnOrder(OrderInterface $order, string $transition)
{
foreach ($order->getPayments() as $payment) {
- $this->orderWorkflow->get($payment, PaymentTransitions::GRAPH)
- ->apply($payment, $transition);
+ $this->orderWorkflow->apply($payment, $transition);
}
}
@@ -137,13 +137,11 @@ private function addVariantWithPriceToOrder(OrderInterface $order, ProductVarian
private function payOrder(OrderInterface $order): void
{
- $this->orderWorkflow->get($order, OrderPaymentTransitions::GRAPH)
- ->apply(OrderPaymentTransitions::TRANSITION_PAY);
+ $this->orderPaymentWorkflow->apply($order,OrderPaymentTransitions::TRANSITION_PAY);
}
private function shipOrder(OrderInterface $order): void
{
- $this->orderWorkflow->get($order, OrderShippingTransitions::GRAPH)
- ->apply(OrderShippingTransitions::TRANSITION_SHIP);
+ $this->shipmentWorkflow->apply($order,OrderShippingTransitions::TRANSITION_SHIP);
}
}
diff --git a/tests/Behat/Resources/services/contexts/setup.xml b/tests/Behat/Resources/services/contexts/setup.xml
index 4822200..9db6ce6 100644
--- a/tests/Behat/Resources/services/contexts/setup.xml
+++ b/tests/Behat/Resources/services/contexts/setup.xml
@@ -17,6 +17,8 @@
+
+