create(); $this->actingAsForApi(User::factory()->create()) ->deleteJson(route('api.groups.destroy', $group)) ->assertForbidden(); } public function testCanDeleteGroup() { $group = Group::factory()->create(); // only super admins can delete groups $this->actingAsForApi(User::factory()->superuser()->create()) ->deleteJson(route('api.groups.destroy', $group)) ->assertStatusMessageIs('success'); $this->assertDatabaseMissing('permission_groups', ['id' => $group->id]); } }