diff --git a/tests/Behat/Context/Admin/ManagingOrdersContext.php b/tests/Behat/Context/Admin/ManagingOrdersContext.php index 49d9c4ef..ae00eb6a 100644 --- a/tests/Behat/Context/Admin/ManagingOrdersContext.php +++ b/tests/Behat/Context/Admin/ManagingOrdersContext.php @@ -87,22 +87,13 @@ public function tryToCreateNewOrderForNewCustomerWithoutEmail(): void /** * @When I add :product to this order - */ - public function addProductToThisOrder(ProductInterface $product): void - { - /** @var ProductVariantInterface $productVariant */ - $productVariant = $product->getVariants()->first(); - $this->orderCreateFormElement->addProduct($productVariant->getDescriptor()); - } - - /** * @When I add :quantity of :product to this order */ - public function addMultipleProductsToThisOrder(int $quantity, ProductInterface $product): void + public function addProductToThisOrder(ProductInterface $product, int $quantity = 1): void { /** @var ProductVariantInterface $productVariant */ $productVariant = $product->getVariants()->first(); - $this->orderCreateFormElement->addMultipleProducts($productVariant->getDescriptor(), $quantity); + $this->orderCreateFormElement->addProductWithQuantity($productVariant->getDescriptor(), $quantity); } /** diff --git a/tests/Behat/Element/Admin/OrderCreateFormElement.php b/tests/Behat/Element/Admin/OrderCreateFormElement.php index 79eae124..9c96e8b2 100644 --- a/tests/Behat/Element/Admin/OrderCreateFormElement.php +++ b/tests/Behat/Element/Admin/OrderCreateFormElement.php @@ -27,15 +27,7 @@ public function __construct( parent::__construct($session, $parameters); } - public function addProduct(string $productVariantDescriptor): void - { - $this->clickOnTabAndWait('Items'); - - $item = $this->addItemAndReturnIt(); - $this->autoCompleteSelector->selectOption($this->getSession(), $item, $productVariantDescriptor); - } - - public function addMultipleProducts(string $productVariantDescriptor, int $quantity): void + public function addProductWithQuantity(string $productVariantDescriptor, int $quantity): void { $this->clickOnTabAndWait('Items'); diff --git a/tests/Behat/Element/Admin/OrderCreateFormElementInterface.php b/tests/Behat/Element/Admin/OrderCreateFormElementInterface.php index 43de22cc..6771e788 100644 --- a/tests/Behat/Element/Admin/OrderCreateFormElementInterface.php +++ b/tests/Behat/Element/Admin/OrderCreateFormElementInterface.php @@ -8,9 +8,7 @@ interface OrderCreateFormElementInterface { - public function addProduct(string $productVariantDescriptor): void; - - public function addMultipleProducts(string $productVariantDescriptor, int $quantity): void; + public function addProductWithQuantity(string $productVariantDescriptor, int $quantity): void; public function removeProduct(string $productVariantDescriptor): void;