create(['name' => 'Personalabteilung']); $page = Page::query()->create(['title' => 'Personal']); $page->publish('Personal', app(Content::class)->sanitize(['blocks' => [ ['type' => 'heading', 'data' => ['text' => 'Allgemeine Hinweise']], ['type' => 'heading', 'data' => ['text' => 'Gehaltsbänder Geschäftsführung'], 'visibility' => ['role' => [(string) $hr->id]]], ]]), User::factory()->admin()->create()); $search = fn (User $user) => collect($this->actingAs($user)->getJson('/suche/live?q=Gehaltsbänder')->json('groups'))->flatMap(fn ($g) => $g['items'] ?? $g['results'] ?? [])->all(); $this->assertSame([], $search(User::factory()->create())); $this->assertNotSame([], $search(User::factory()->withRoles([$hr])->create())); } }