File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -833,7 +833,8 @@ public function it_can_reject_permission_based_on_logged_in_user_guard()
833
833
public function it_fires_an_event_when_a_permission_is_added ()
834
834
{
835
835
Event::fake ();
836
-
836
+ app ('config ' )->set ('permission.events_enabled ' , true );
837
+
837
838
$ this ->testUser ->givePermissionTo (['edit-articles ' , 'edit-news ' ]);
838
839
839
840
$ ids = app (Permission::class)::whereIn ('name ' , ['edit-articles ' , 'edit-news ' ])
@@ -850,10 +851,27 @@ public function it_fires_an_event_when_a_permission_is_added()
850
851
851
852
/** @test */
852
853
#[Test]
853
- public function it_fires_an_event_when_a_permission_is_removed ()
854
+ public function it_does_not_fire_an_event_when_events_are_not_enabled ()
854
855
{
855
856
Event::fake ();
857
+ app ('config ' )->set ('permission.events_enabled ' , false );
858
+
859
+ $ this ->testUser ->givePermissionTo (['edit-articles ' , 'edit-news ' ]);
860
+
861
+ $ ids = app (Permission::class)::whereIn ('name ' , ['edit-articles ' , 'edit-news ' ])
862
+ ->pluck ($ this ->testUserPermission ->getKeyName ())
863
+ ->toArray ();
856
864
865
+ Event::assertNotDispatched (PermissionAttached::class);
866
+ }
867
+
868
+ /** @test */
869
+ #[Test]
870
+ public function it_fires_an_event_when_a_permission_is_removed ()
871
+ {
872
+ Event::fake ();
873
+ app ('config ' )->set ('permission.events_enabled ' , true );
874
+
857
875
$ permissions = app (Permission::class)::whereIn ('name ' , ['edit-articles ' , 'edit-news ' ])->get ();
858
876
859
877
$ this ->testUser ->givePermissionTo ($ permissions );
You can’t perform that action at this time.
0 commit comments