mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Improve cancel unpaid orders test
This commit is contained in:
parent
af52ac2bd6
commit
a45a544bb1
2 changed files with 14 additions and 16 deletions
|
|
@ -1,9 +1,9 @@
|
|||
@cli
|
||||
Feature: Cancel unpaid orders
|
||||
In order to manually cancel only unpaid orders
|
||||
As a developer
|
||||
I need to use command in terminal
|
||||
Feature: Canceling unpaid orders
|
||||
In order to have my orders list free from completed but unpaid orders
|
||||
As a Developer
|
||||
I want to have unpaid orders cancelled
|
||||
|
||||
Scenario: Canceling unpaid orders from console
|
||||
When I run command that cancels unpaid orders
|
||||
Then I should see output "Unpaid orders has been canceled" message in terminal
|
||||
Scenario: Canceling unpaid orders
|
||||
When the unpaid orders has been cancelled
|
||||
Then I should see be informed that unpaid orders have been cancelled
|
||||
|
|
|
|||
|
|
@ -15,14 +15,13 @@ namespace Sylius\Behat\Context\Cli;
|
|||
|
||||
use Webmozart\Assert\Assert;
|
||||
use Behat\Behat\Context\Context;
|
||||
use Sylius\Bundle\CoreBundle\Command\SetupCommand;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
|
||||
final class CancelUnpaidOrdersContext implements Context
|
||||
{
|
||||
private const COMMAND_CANCEL_UNPAID_ORDERS = 'sylius:cancel-unpaid-orders';
|
||||
private const CANCEL_UNPAID_ORDERS_COMMAND = 'sylius:cancel-unpaid-orders';
|
||||
|
||||
private Application $application;
|
||||
|
||||
|
|
@ -31,25 +30,24 @@ final class CancelUnpaidOrdersContext implements Context
|
|||
public function __construct(KernelInterface $kernel)
|
||||
{
|
||||
$this->application = new Application($kernel);
|
||||
$this->application->add(new SetupCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I run command that cancels unpaid orders
|
||||
* @When the unpaid orders has been cancelled
|
||||
*/
|
||||
public function runCancelUnpaidOrdersCommand(): void
|
||||
{
|
||||
$command = $this->application->find(self::COMMAND_CANCEL_UNPAID_ORDERS);
|
||||
$command = $this->application->find(self::CANCEL_UNPAID_ORDERS_COMMAND);
|
||||
|
||||
$this->commandTester = new CommandTester($command);
|
||||
$this->commandTester->execute(['command' => self::COMMAND_CANCEL_UNPAID_ORDERS]);
|
||||
$this->commandTester->execute(['command' => self::CANCEL_UNPAID_ORDERS_COMMAND]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see output :output message in terminal
|
||||
* @Then I should see be informed that unpaid orders have been cancelled
|
||||
*/
|
||||
public function shouldSeeOutputMessage(string $output): void
|
||||
public function shouldSeeOutputMessage(): void
|
||||
{
|
||||
Assert::contains($this->commandTester->getDisplay(), $output);
|
||||
Assert::contains($this->commandTester->getDisplay(), "Unpaid orders has been canceled");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue