-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
92 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
default: | ||
autoload: | ||
- %paths.base%/vendor/autoload.php | ||
suites: | ||
default: | ||
contexts: | ||
- tests\Clearcode\CommandBusConsole\Contexts\CLIContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Feature: Handle command | ||
|
||
Scenario: Successfully handle command | ||
When I run command "command-bus:handle SuccessfulCommand" | ||
Then command should end successfully |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace tests\Clearcode\CommandBusConsole\CommandBus; | ||
|
||
final class SuccessfulCommand | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace tests\Clearcode\CommandBusConsole\CommandBus; | ||
|
||
final class SuccessfulCommandHandler | ||
{ | ||
public function handle(SuccessfulCommand $successCommand) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace tests\Clearcode\CommandBusConsole\Contexts; | ||
|
||
use Assert\Assertion; | ||
use Behat\Behat\Context\Context; | ||
use Behat\Behat\Context\SnippetAcceptingContext; | ||
use Clearcode\CommandBusConsole\Bundle\Command\CommandBusConsoleCommand; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Input\StringInput; | ||
use Symfony\Component\Console\Output\StreamOutput; | ||
use tests\Clearcode\CommandBusConsole\Bundle\App\TestKernel; | ||
|
||
class CLIContext implements Context, SnippetAcceptingContext | ||
{ | ||
private $app; | ||
|
||
private $status; | ||
|
||
public function __construct() | ||
{ | ||
$kernel = new TestKernel('test', false); | ||
$this->app = new Application($kernel); | ||
$this->app->setAutoExit(false); | ||
$this->app->add(new CommandBusConsoleCommand()); | ||
} | ||
|
||
/** | ||
* @When I run command :command | ||
*/ | ||
public function iRunCommand($command) | ||
{ | ||
$input = new StringInput($command); | ||
$output = new StreamOutput(fopen('php://memory', 'w')); | ||
|
||
$this->status = $this->app->run($input, $output); | ||
} | ||
|
||
/** | ||
* @Then command should end successfully | ||
*/ | ||
public function commandShouldEndSuccessfully() | ||
{ | ||
Assertion::same($this->status, 0); | ||
} | ||
} |