File tree Expand file tree Collapse file tree 4 files changed +67
-0
lines changed Expand file tree Collapse file tree 4 files changed +67
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Jaspaul \LaravelRollout \Console ;
4
+
5
+ class DeleteCommand extends RolloutCommand
6
+ {
7
+ /**
8
+ * The name and signature of the console command.
9
+ *
10
+ * @var string
11
+ */
12
+ protected $ signature = 'rollout:delete {feature} ' ;
13
+
14
+ /**
15
+ * The console command description.
16
+ *
17
+ * @var string
18
+ */
19
+ protected $ description = 'Deletes the feature with the provided name. ' ;
20
+
21
+ /**
22
+ * Deletes the provided feature.
23
+ *
24
+ * @return void
25
+ */
26
+ public function handle ()
27
+ {
28
+ $ name = $ this ->argument ('feature ' );
29
+ $ this ->rollout ->remove ($ name );
30
+ }
31
+ }
Original file line number Diff line number Diff line change 6
6
use Jaspaul \LaravelRollout \Drivers \Cache ;
7
7
use Jaspaul \LaravelRollout \Console \ListCommand ;
8
8
use Jaspaul \LaravelRollout \Console \CreateCommand ;
9
+ use Jaspaul \LaravelRollout \Console \DeleteCommand ;
9
10
use Jaspaul \LaravelRollout \Console \AddUserCommand ;
10
11
use Jaspaul \LaravelRollout \Console \RemoveUserCommand ;
11
12
use Illuminate \Support \ServiceProvider as IlluminateServiceProvider ;
@@ -26,6 +27,7 @@ public function boot()
26
27
$ this ->commands ([
27
28
AddUserCommand::class,
28
29
CreateCommand::class,
30
+ DeleteCommand::class,
29
31
ListCommand::class,
30
32
RemoveUserCommand::class
31
33
]);
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests \Drivers ;
4
+
5
+ use Tests \TestCase ;
6
+ use Opensoft \Rollout \Rollout ;
7
+ use Illuminate \Support \Facades \Artisan ;
8
+ use Jaspaul \LaravelRollout \Drivers \Cache ;
9
+
10
+ class DeleteCommandTest extends TestCase
11
+ {
12
+ /**
13
+ * @test
14
+ */
15
+ function running_the_command_with_a_feature_will_remove_the_corresponding_feature ()
16
+ {
17
+ $ store = app ()->make ('cache.store ' )->getStore ();
18
+
19
+ $ rollout = app ()->make (Rollout::class);
20
+ $ rollout ->get ('derp ' );
21
+
22
+ $ this ->assertEquals ('derp ' , $ store ->get ('rollout.feature:__features__ ' ));
23
+
24
+ Artisan::call ('rollout:delete ' , [
25
+ 'feature ' => 'derp '
26
+ ]);
27
+
28
+ $ store = app ()->make ('cache.store ' )->getStore ();
29
+
30
+ $ this ->assertEquals ('' , $ store ->get ('rollout.feature:__features__ ' ));
31
+ }
32
+ }
Original file line number Diff line number Diff line change 9
9
use Jaspaul \LaravelRollout \ServiceProvider ;
10
10
use Jaspaul \LaravelRollout \Console \ListCommand ;
11
11
use Jaspaul \LaravelRollout \Console \CreateCommand ;
12
+ use Jaspaul \LaravelRollout \Console \DeleteCommand ;
12
13
use Jaspaul \LaravelRollout \Console \AddUserCommand ;
13
14
use Jaspaul \LaravelRollout \Console \RemoveUserCommand ;
14
15
use Illuminate \Support \ServiceProvider as IlluminateServiceProvider ;
@@ -67,6 +68,7 @@ function booting_registers_our_commands()
67
68
[
68
69
AddUserCommand::class,
69
70
CreateCommand::class,
71
+ DeleteCommand::class,
70
72
ListCommand::class,
71
73
RemoveUserCommand::class
72
74
],
You can’t perform that action at this time.
0 commit comments