diff --git a/src/Commands/CheckCommand.php b/src/Commands/CheckCommand.php index 03fc134..3fac7bd 100644 --- a/src/Commands/CheckCommand.php +++ b/src/Commands/CheckCommand.php @@ -16,12 +16,12 @@ public function handle(): int { $newVersionAvailable = Updater::newVersionAvailable(); if (! is_array($newVersionAvailable)) { - $this->info('No new version available'); + $this->components->info('No new version available'); return self::SUCCESS; } - $this->info('New version available: '.$newVersionAvailable['latest_version']); + $this->components->info('New version available: '.$newVersionAvailable['latest_version']); event(new NewVersionAvailable($newVersionAvailable['current_version'], $newVersionAvailable['latest_version'])); diff --git a/src/Commands/UpdaterCommand.php b/src/Commands/UpdaterCommand.php index b799c13..325a22e 100644 --- a/src/Commands/UpdaterCommand.php +++ b/src/Commands/UpdaterCommand.php @@ -15,18 +15,18 @@ public function handle(): int { $newVersionAvailable = Updater::newVersionAvailable(); if (! is_array($newVersionAvailable)) { - $this->error('No new version available'); + $this->components->error('No new version available'); return self::FAILURE; } - $this->comment('Updating to version '.$newVersionAvailable['latest_version']); + $this->components->info('Updating to version '.$newVersionAvailable['latest_version']); Updater::update(output: function ($message) { - $this->comment($message); + $this->components->task($message); }); - $this->info('Application updated! You are now on version '.Updater::getCurrentVersion().'!'); + $this->components->twoColumnDetail('Application updated', Updater::getCurrentVersion()); return self::SUCCESS; } diff --git a/src/Pipelines/ArtisanCallCacheClearPipe.php b/src/Pipelines/ArtisanCallCacheClearPipe.php index 57793e9..5b8c81d 100644 --- a/src/Pipelines/ArtisanCallCacheClearPipe.php +++ b/src/Pipelines/ArtisanCallCacheClearPipe.php @@ -18,7 +18,7 @@ class ArtisanCallCacheClearPipe implements Pipeline public function handle($content, Closure $next) { if (is_callable($content['output'])) { - call_user_func($content['output'], 'Clearing cache...'); + call_user_func($content['output'], 'Start clearing cache'); } Artisan::call('cache:clear'); diff --git a/src/Pipelines/ArtisanCallConfigClearPipe.php b/src/Pipelines/ArtisanCallConfigClearPipe.php index 0ba9bb9..500936e 100644 --- a/src/Pipelines/ArtisanCallConfigClearPipe.php +++ b/src/Pipelines/ArtisanCallConfigClearPipe.php @@ -18,7 +18,7 @@ class ArtisanCallConfigClearPipe implements Pipeline public function handle($content, Closure $next) { if (is_callable($content['output'])) { - call_user_func($content['output'], 'Clearing config cache...'); + call_user_func($content['output'], 'Start clearing config cache'); } Artisan::call('config:clear'); diff --git a/src/Pipelines/ArtisanCallMigratePipe.php b/src/Pipelines/ArtisanCallMigratePipe.php index aaa6811..22ecd9a 100644 --- a/src/Pipelines/ArtisanCallMigratePipe.php +++ b/src/Pipelines/ArtisanCallMigratePipe.php @@ -18,7 +18,7 @@ class ArtisanCallMigratePipe implements Pipeline public function handle($content, Closure $next) { if (is_callable($content['output'])) { - call_user_func($content['output'], 'Migrating...'); + call_user_func($content['output'], 'Start migrating'); } Artisan::call('migrate', [ diff --git a/src/Pipelines/ArtisanCallOptimizePipe.php b/src/Pipelines/ArtisanCallOptimizePipe.php index 2b4af32..511f258 100644 --- a/src/Pipelines/ArtisanCallOptimizePipe.php +++ b/src/Pipelines/ArtisanCallOptimizePipe.php @@ -18,7 +18,7 @@ class ArtisanCallOptimizePipe implements Pipeline public function handle($content, Closure $next) { if (is_callable($content['output'])) { - call_user_func($content['output'], 'Optimizing...'); + call_user_func($content['output'], 'Start optimizing'); } Artisan::call('optimize'); diff --git a/src/Pipelines/ArtisanCallRouteClearPipe.php b/src/Pipelines/ArtisanCallRouteClearPipe.php index 58130d5..08e4cbc 100644 --- a/src/Pipelines/ArtisanCallRouteClearPipe.php +++ b/src/Pipelines/ArtisanCallRouteClearPipe.php @@ -18,7 +18,7 @@ class ArtisanCallRouteClearPipe implements Pipeline public function handle($content, Closure $next) { if (is_callable($content['output'])) { - call_user_func($content['output'], 'Clearing route cache...'); + call_user_func($content['output'], 'Start clearing route cache'); } Artisan::call('route:clear'); diff --git a/src/Pipelines/ArtisanCallViewClearPipe.php b/src/Pipelines/ArtisanCallViewClearPipe.php index a3759b0..ff94c3f 100644 --- a/src/Pipelines/ArtisanCallViewClearPipe.php +++ b/src/Pipelines/ArtisanCallViewClearPipe.php @@ -18,7 +18,7 @@ class ArtisanCallViewClearPipe implements Pipeline public function handle($content, Closure $next) { if (is_callable($content['output'])) { - call_user_func($content['output'], 'Clearing view cache...'); + call_user_func($content['output'], 'Start clearing view cache'); } Artisan::call('view:clear'); diff --git a/src/Pipelines/GitPipe.php b/src/Pipelines/GitPipe.php index 75fd641..ecd801b 100644 --- a/src/Pipelines/GitPipe.php +++ b/src/Pipelines/GitPipe.php @@ -21,7 +21,7 @@ public function handle($content, Closure $next) $version = $content['new_version']; if (is_callable($content['output'])) { - call_user_func($content['output'], 'Downloading version '.$version.' ...'); + call_user_func($content['output'], 'Start downloading version '.$version); } Git::auth(); diff --git a/src/Pipelines/SeedersPipe.php b/src/Pipelines/SeedersPipe.php index 063d753..0e6bdc1 100644 --- a/src/Pipelines/SeedersPipe.php +++ b/src/Pipelines/SeedersPipe.php @@ -18,7 +18,7 @@ class SeedersPipe implements Pipeline public function handle($content, Closure $next) { if (is_callable($content['output'])) { - call_user_func($content['output'], 'Seeding...'); + call_user_func($content['output'], 'Start seeding'); } $classes = config('updater.seeders', []); diff --git a/src/Updater.php b/src/Updater.php index fafb5f7..50d8fdb 100644 --- a/src/Updater.php +++ b/src/Updater.php @@ -43,7 +43,7 @@ private function updateTo($version): string try { if (config('updater.maintenance_mode', false)) { - $this->output('Maintenance mode is on, turning it on...'); + $this->output('Maintenance mode is on, turning it on'); Artisan::call( 'down', @@ -119,7 +119,7 @@ function ($content) { ); if (config('updater.maintenance_mode', false)) { - $this->output('Maintenance mode is on, turning it off...'); + $this->output('Maintenance mode is on, turning it off'); Artisan::call('up'); } @@ -128,7 +128,7 @@ function ($content) { return 'Updated to version '.$version; } catch (\Throwable $th) { if (config('updater.maintenance_mode', false)) { - $this->output('Maintenance mode is on, turning it off...'); + $this->output('Maintenance mode is on, turning it off'); Artisan::call('up'); } diff --git a/tests/Commands/CheckCommandTest.php b/tests/Commands/CheckCommandTest.php index 439ebdd..a6ad693 100644 --- a/tests/Commands/CheckCommandTest.php +++ b/tests/Commands/CheckCommandTest.php @@ -15,7 +15,7 @@ public function it_does_not_show_any_message_if_no_new_version_is_available() Updater::shouldReceive('newVersionAvailable')->once()->andReturn(false); $this->artisan('updater:check') - ->expectsOutput('No new version available') + ->expectsOutputToContain('No new version available') ->assertExitCode(CheckCommand::SUCCESS); } @@ -28,7 +28,7 @@ public function it_shows_a_message_if_a_new_version_is_available() ]); $this->artisan('updater:check') - ->expectsOutput('New version available: 1.1.0') + ->expectsOutputToContain('New version available: 1.1.0') ->assertExitCode(CheckCommand::SUCCESS); } @@ -43,7 +43,7 @@ public function it_fires_a_new_version_available_event_if_a_new_version_is_avail ]); $this->artisan('updater:check') - ->expectsOutput('New version available: 1.1.0'); + ->expectsOutputToContain('New version available: 1.1.0'); Event::assertDispatched(NewVersionAvailable::class, function ($event) { return $event->currentVersion === '1.0.0' && $event->newVersion === '1.1.0'; diff --git a/tests/Commands/UpdaterCommandTest.php b/tests/Commands/UpdaterCommandTest.php index c9ff548..48fc516 100644 --- a/tests/Commands/UpdaterCommandTest.php +++ b/tests/Commands/UpdaterCommandTest.php @@ -37,8 +37,10 @@ public function it_updates_the_application() // Call the UpdaterCommand $this->artisan('updater:update') - ->expectsOutput('Updating to version v1.0.1') - ->expectsOutput('Application updated! You are now on version v1.0.0!') // in real life this should be v1.0.1 but we mock it to v1.0.0 + ->expectsOutputToContain('Updating to version v1.0.1') + ->expectsOutputToContain('Application updated') // in real life this should be v1.0.1 but we mock it to v1.0.0 + // ->expectsOutputToContain('v1.0.0') // in real life this should be v1.0.1 but we mock it to v1.0.0 + // ->expectsOutputToContain('You are now on version') // in real life this should be v1.0.1 but we mock it to v1.0.0 ->assertExitCode(0); } @@ -52,7 +54,7 @@ public function it_does_not_update_when_no_new_version_available() // Call the UpdaterCommand $this->artisan('updater:update') - ->expectsOutput('No new version available') + ->expectsOutputToContain('No new version available') ->assertExitCode(1); } } diff --git a/tests/Pipelines/ArtisanCallCacheClearPipeTest.php b/tests/Pipelines/ArtisanCallCacheClearPipeTest.php index 42b4508..1e9bc2e 100644 --- a/tests/Pipelines/ArtisanCallCacheClearPipeTest.php +++ b/tests/Pipelines/ArtisanCallCacheClearPipeTest.php @@ -15,7 +15,7 @@ public function test_run_handle() ]); $messages = [ - 'Clearing cache...', + 'Start clearing cache', 'Cache cleared!', ]; diff --git a/tests/Pipelines/ArtisanCallConfigClearPipeTest.php b/tests/Pipelines/ArtisanCallConfigClearPipeTest.php index 49f095e..94b1024 100644 --- a/tests/Pipelines/ArtisanCallConfigClearPipeTest.php +++ b/tests/Pipelines/ArtisanCallConfigClearPipeTest.php @@ -15,7 +15,7 @@ public function test_run_handle() ]); $messages = [ - 'Clearing config cache...', + 'Start clearing config cache', 'Config cache cleared!', ]; diff --git a/tests/Pipelines/ArtisanCallMigratePipeTest.php b/tests/Pipelines/ArtisanCallMigratePipeTest.php index 1a49bc1..b791a57 100644 --- a/tests/Pipelines/ArtisanCallMigratePipeTest.php +++ b/tests/Pipelines/ArtisanCallMigratePipeTest.php @@ -15,7 +15,7 @@ public function test_run_handle() ]); $messages = [ - 'Migrating...', + 'Start migrating', 'Migrated!', ]; diff --git a/tests/Pipelines/ArtisanCallOptimizePipeTest.php b/tests/Pipelines/ArtisanCallOptimizePipeTest.php index 2297a10..7285648 100644 --- a/tests/Pipelines/ArtisanCallOptimizePipeTest.php +++ b/tests/Pipelines/ArtisanCallOptimizePipeTest.php @@ -15,7 +15,7 @@ public function test_run_handle() ]); $messages = [ - 'Optimizing...', + 'Start optimizing', 'Optimized!', ]; diff --git a/tests/Pipelines/ArtisanCallRouteClearPipeTest.php b/tests/Pipelines/ArtisanCallRouteClearPipeTest.php index bb8741f..4d9c6ae 100644 --- a/tests/Pipelines/ArtisanCallRouteClearPipeTest.php +++ b/tests/Pipelines/ArtisanCallRouteClearPipeTest.php @@ -15,7 +15,7 @@ public function test_run_handle() ]); $messages = [ - 'Clearing route cache...', + 'Start clearing route cache', 'Route cache cleared!', ]; diff --git a/tests/Pipelines/ArtisanCallViewClearPipeTest.php b/tests/Pipelines/ArtisanCallViewClearPipeTest.php index 49825fe..6a96846 100644 --- a/tests/Pipelines/ArtisanCallViewClearPipeTest.php +++ b/tests/Pipelines/ArtisanCallViewClearPipeTest.php @@ -15,7 +15,7 @@ public function test_run_handle() ]); $messages = [ - 'Clearing view cache...', + 'Start clearing view cache', 'View cache cleared!', ]; diff --git a/tests/Pipelines/GitPipeTest.php b/tests/Pipelines/GitPipeTest.php index 809b93a..ce0cc38 100644 --- a/tests/Pipelines/GitPipeTest.php +++ b/tests/Pipelines/GitPipeTest.php @@ -15,7 +15,7 @@ public function test_run_handle() ]); $messages = [ - 'Downloading version 1.0.0 ...', + 'Start downloading version 1.0.0', 'Checkout success', ]; @@ -42,7 +42,7 @@ public function test_run_handle_with_error() ]); $messages = [ - 'Downloading version 1.0.0 ...', + 'Start downloading version 1.0.0', 'git checkout failed: error', ]; diff --git a/tests/Pipelines/SeedersPipeTest.php b/tests/Pipelines/SeedersPipeTest.php index 0c7cfc9..e0300d0 100644 --- a/tests/Pipelines/SeedersPipeTest.php +++ b/tests/Pipelines/SeedersPipeTest.php @@ -10,7 +10,7 @@ class SeedersPipeTest extends TestCase public function test_run_handle() { $messages = [ - 'Seeding...', + 'Start seeding', 'Seeded!', ];