-
Notifications
You must be signed in to change notification settings - Fork 2
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
2 changed files
with
72 additions
and
8 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,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Tempest\Console\Testing; | ||
|
||
use Tempest\Console\Console; | ||
use Tests\Tempest\Console\Fixtures\ComplexCommand; | ||
use Tests\Tempest\Console\Fixtures\InteractiveCommand; | ||
use Tests\Tempest\Console\TestCase; | ||
|
||
/** | ||
* @internal | ||
* @small | ||
*/ | ||
class ConsoleTesterTest extends TestCase | ||
{ | ||
public function test_call_with_invokable(): void | ||
{ | ||
$this->console | ||
->call(ComplexCommand::class) | ||
->assertContains('complex <a> <b> <c>'); | ||
} | ||
|
||
public function test_call_with_closure(): void | ||
{ | ||
$this->console | ||
->call(function (Console $console) { | ||
$console->writeln('hi'); | ||
}) | ||
->assertContains('hi'); | ||
} | ||
|
||
public function test_call_with_callable(): void | ||
{ | ||
$this->console | ||
->call([InteractiveCommand::class, 'validation']) | ||
->assertContains('a'); | ||
} | ||
|
||
public function test_call_with_command(): void | ||
{ | ||
$this->console | ||
->call('interactive:validation') | ||
->assertContains('a'); | ||
} | ||
} |