set('projectsend.edition', Edition::Community); $this->admin = User::factory()->create(); }); test('the roles screen offers the moderation permission, under Files', function () { $this->actingAs($this->admin)->get('/roles/create') ->assertOk() ->assertInertia(function (AssertableInertia $page) { $catalog = collect($page->toArray()['props']['catalog']); $files = $catalog->firstWhere('key', 'files'); expect(collect($files['permissions'])->pluck('key'))->toContain('moderate_comments'); }); }); test('granting it through the roles screen is what opens the queue', function () { $role = Role::query()->create(['name' => 'Moderator', 'is_system' => false, 'is_administrator' => false]); $staff = User::factory()->create(['role_id' => $role->id]); $this->actingAs($staff)->get('/comments')->assertForbidden(); $this->actingAs($this->admin)->patch("/roles/{$role->id}", [ 'name' => 'Moderator', 'permissions' => ['upload', 'moderate_comments'], ])->assertRedirect(); forgetRequestState(); $this->actingAs($staff)->get('/comments')->assertOk(); });