diff --git a/tests/Feature/Groups/Api/DeleteGroupTest.php b/tests/Feature/Groups/Api/DeleteGroupTest.php new file mode 100644 index 0000000000..8d057a7ed3 --- /dev/null +++ b/tests/Feature/Groups/Api/DeleteGroupTest.php @@ -0,0 +1,32 @@ +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]); + } +}