-
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
1 parent
e4b1e45
commit 2a1037d
Showing
3 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\BLT\Features; | ||
|
||
use Behat\Behat\Context\Context; | ||
use Blumilk\BLT\Features\Traits\Console as ConsoleTrait; | ||
|
||
class Console implements Context | ||
{ | ||
use ConsoleTrait; | ||
} |
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,62 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\BLT\Features\Traits; | ||
|
||
use Illuminate\Support\Facades\Artisan; | ||
use PHPUnit\Framework\Assert; | ||
|
||
trait Console | ||
{ | ||
use Application; | ||
|
||
private $consoleOutput = ""; | ||
|
||
/** | ||
* @Given I run :command command | ||
* @Given I run :command in console | ||
*/ | ||
public function runCommand(string $command): void | ||
{ | ||
$this->consoleOutput = ""; | ||
Artisan::call($command); | ||
$this->consoleOutput = Artisan::output(); | ||
} | ||
|
||
/** | ||
* @Given I run :command command with arguments :arguments | ||
* @Given I run :command command with argument :arguments | ||
* @Given I run :command command with options :arguments | ||
* @Given I run :command command with option :arguments | ||
*/ | ||
public function runCommandWithArguments(string $command, string $arguments): void | ||
{ | ||
$this->runCommand("$command $arguments"); | ||
} | ||
|
||
/** | ||
* @Then I see :output in console | ||
* @Then I should see :output in console | ||
*/ | ||
public function seeInConsole(string $output): void | ||
{ | ||
Assert::assertStringContainsString($output, $this->consoleOutput); | ||
} | ||
|
||
/** | ||
* @Then Console output is not empty | ||
*/ | ||
public function consoleOutputIsNotEmpty(): void | ||
{ | ||
Assert::assertNotEmpty($this->consoleOutput); | ||
} | ||
|
||
/** | ||
* @Then Console output is empty | ||
*/ | ||
public function consoleOutputIsEmpty(): void | ||
{ | ||
Assert::assertEmpty($this->consoleOutput); | ||
} | ||
} |