-
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
5 changed files
with
81 additions
and
17 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
tests/Feature/Console/Commands/OrchestrateStubsCommandTest.php
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,60 @@ | ||
<?php | ||
|
||
namespace Payavel\Orchestration\Tests\Feature\Console\Commands; | ||
|
||
use Payavel\Orchestration\Console\Commands\OrchestrateStubs; | ||
use Payavel\Orchestration\Tests\TestCase; | ||
use PHPUnit\Framework\Attributes\Test; | ||
|
||
class OrchestrateStubsCommandTest extends TestCase | ||
{ | ||
#[Test] | ||
public function publish_stubs_command_publishes_stubs() | ||
{ | ||
$this->artisan('orchestrate:stubs') | ||
->expectsOutput('Successfully published stubs!') | ||
->assertExitCode(0); | ||
|
||
foreach(OrchestrateStubs::$baseStubs as $stub) { | ||
$this->assertFileExists(base_path('stubs/orchestration/' . $stub . '.stub')); | ||
} | ||
} | ||
|
||
#[Test] | ||
public function publish_stubs_command_publishes_stubs_for_service() | ||
{ | ||
$this->artisan('orchestrate:stubs', [ | ||
'--service' => 'mock', | ||
]) | ||
->expectsOutput('Successfully published stubs!') | ||
->assertExitCode(0); | ||
|
||
foreach(OrchestrateStubs::$serviceSpecificStubs as $stub) { | ||
$this->assertFileExists(base_path('stubs/orchestration/mock/' . $stub . '.stub')); | ||
} | ||
} | ||
|
||
#[Test] | ||
public function publish_stubs_command_publishes_single_stub_file() | ||
{ | ||
$this->artisan('orchestrate:stubs', [ | ||
'stub' => $stub = $this->faker->randomElement(OrchestrateStubs::$baseStubs), | ||
]) | ||
->expectsOutput('Successfully published stub!') | ||
->assertExitCode(0); | ||
|
||
$this->assertFileExists(base_path('stubs/orchestration/' . $stub . '.stub')); | ||
} | ||
|
||
#[Test] | ||
public function publish_stubs_command_throws_error_when_single_stub_file_does_not_exist() | ||
{ | ||
$this->artisan('orchestrate:stubs', [ | ||
'stub' => 'stub', | ||
]) | ||
->expectsOutput('The stub file you wish to publish is not available.') | ||
->assertExitCode(0); | ||
|
||
$this->assertFileDoesNotExist(base_path('stubs/orchestration/stub.stub')); | ||
} | ||
} |
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