diff --git a/src/Commands/PurgeCommand.php b/src/Commands/PurgeCommand.php index f75eca7..b37eb02 100644 --- a/src/Commands/PurgeCommand.php +++ b/src/Commands/PurgeCommand.php @@ -61,9 +61,13 @@ public function handle(FeatureManager $manager) $store->purge($features); - with($features ?: ['All features'], function ($names) { - $this->components->info(implode(', ', $names).' successfully purged from storage.'); - }); + if ($features) { + $this->components->info(implode(', ', $features).' successfully purged from storage.'); + } elseif ($except) { + $this->components->info('No features to purge from storage.'); + } else { + $this->components->info('All features successfully purged from storage.'); + } return self::SUCCESS; } diff --git a/tests/Feature/PurgeCommandTest.php b/tests/Feature/PurgeCommandTest.php index de67cfd..cdbd9f9 100644 --- a/tests/Feature/PurgeCommandTest.php +++ b/tests/Feature/PurgeCommandTest.php @@ -133,6 +133,20 @@ public function test_it_can_exclude_features_to_purge_from_storage() $this->assertSame(0, DB::table('features')->count()); } + public function test_it_outputs_that_no_features_have_been_purged() + { + Feature::define('foo', true); + + Feature::for('tim')->active('foo'); + Feature::for('taylor')->active('foo'); + + $this->assertSame(2, DB::table('features')->where('name', 'foo')->count()); + + $this->artisan('pennant:purge --except=foo')->expectsOutputToContain('No features to purge from storage.'); + + $this->assertSame(2, DB::table('features')->where('name', 'foo')->count()); + } + public function test_it_can_combine_except_and_features_as_arguments() { DB::table('features')->insert([