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