Skip to content

Commit

Permalink
Rename service:stubs command to orchestrate:stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
r-kujawa committed Jan 18, 2024
1 parent 27d6ff2 commit 00de2db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Support\Str;
use Payavel\Orchestration\Traits\GeneratesFiles;

class PublishStubs extends Command
class OrchestrateStubs extends Command
{
use GeneratesFiles;

Expand All @@ -15,7 +15,7 @@ class PublishStubs extends Command
*
* @var string
*/
protected $signature = 'service:stubs
protected $signature = 'orchestrate:stubs
{stub? : The stub file}
{--service= : The service}';

Expand Down
4 changes: 2 additions & 2 deletions src/OrchestrationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Support\ServiceProvider;
use Payavel\Orchestration\Console\Commands\OrchestrateService;
use Payavel\Orchestration\Console\Commands\OrchestrateProvider;
use Payavel\Orchestration\Console\Commands\PublishStubs;
use Payavel\Orchestration\Console\Commands\OrchestrateStubs;

class OrchestrationServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -42,7 +42,7 @@ protected function registerCommands()
$this->commands([
OrchestrateService::class,
OrchestrateProvider::class,
PublishStubs::class,
OrchestrateStubs::class,
]);
}

Expand Down
18 changes: 9 additions & 9 deletions tests/Feature/Console/Commands/PublishStubsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@

namespace Payavel\Orchestration\Tests\Feature\Console\Commands;

use Payavel\Orchestration\Console\Commands\PublishStubs;
use Payavel\Orchestration\Console\Commands\OrchestrateStubs;
use Payavel\Orchestration\Tests\TestCase;

class PublishStubsCommandTest extends TestCase
class OrchestrateStubsCommandTest extends TestCase
{
/** @test */
public function publish_stubs_command_publishes_stubs()
{
$this->artisan('service:stubs')
$this->artisan('orchestrate:stubs')
->expectsOutput('Successfully published stubs!')
->assertExitCode(0);

foreach(PublishStubs::$baseStubs as $stub) {
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('service:stubs', [
$this->artisan('orchestrate:stubs', [
'--service' => 'mock',
])
->expectsOutput('Successfully published stubs!')
->assertExitCode(0);

foreach(PublishStubs::$serviceSpecificStubs as $stub) {
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('service:stubs', [
'stub' => $stub = $this->faker->randomElement(PublishStubs::$baseStubs),
$this->artisan('orchestrate:stubs', [
'stub' => $stub = $this->faker->randomElement(OrchestrateStubs::$baseStubs),
])
->expectsOutput('Successfully published stub!')
->assertExitCode(0);
Expand All @@ -48,7 +48,7 @@ public function publish_stubs_command_publishes_single_stub_file()
/** @test */
public function publish_stubs_command_throws_error_when_single_stub_file_does_not_exist()
{
$this->artisan('service:stubs', [
$this->artisan('orchestrate:stubs', [
'stub' => 'stub',
])
->expectsOutput('The stub file you wish to publish is not available.')
Expand Down

0 comments on commit 00de2db

Please sign in to comment.