[ ['id' => 'text1', 'type' => 'text', 'data' => ['html' => '

Musterstift gGmbH, Hauptstraße 1

']], ['id' => 'text2', 'type' => 'text', 'data' => ['html' => '

Nur für die Pflege

'], 'visibility' => ['role' => ['999999']]], ['id' => 'tile1', 'type' => 'dashboard.widget', 'data' => ['widget' => 'core.quick-links']], ]]; } public function test_draft_publish_and_rendering_for_everyone(): void { $admin = User::factory()->admin()->create(); $user = User::factory()->create(); $this->actingAs($user)->get('/')->assertInertia(fn (Assert $p) => $p->where('footerContent', null)); $this->actingAs($admin)->get('/fusszeile/gestalten')->assertOk()->assertInertia(fn (Assert $p) => $p ->component('HomepageEditor')->where('config.kind', 'footer')->has('content.blocks', 1)); $this->actingAs($admin)->putJson('/fusszeile/gestalten/entwurf', ['content' => $this->content()])->assertOk()->assertJsonPath('state.has_draft', true); $this->actingAs($user)->get('/')->assertInertia(fn (Assert $p) => $p->where('footerContent', null)); // Vorschau des Entwurfs nur für die Administration $this->actingAs($admin)->get('/?fusszeile=entwurf')->assertInertia(fn (Assert $p) => $p->has('footerContent.blocks', 2)); $this->actingAs($user)->get('/?fusszeile=entwurf')->assertInertia(fn (Assert $p) => $p->where('footerContent', null)); $this->actingAs($admin)->postJson('/fusszeile/gestalten/veroeffentlichen')->assertOk()->assertJsonPath('state.published', true); // Zielgruppen-Blöcke fallen für andere weg, Kacheln werden aufgelöst $this->actingAs($user)->get('/neuigkeiten')->assertInertia(fn (Assert $p) => $p ->has('footerContent.blocks', 2) ->where('footerContent.blocks.0.data.html', '

Musterstift gGmbH, Hauptstraße 1

') ->where('footerContent.blocks.1.type', 'dashboard.widget')); } public function test_only_appearance_managers_edit_and_hiding_works(): void { $user = User::factory()->create(); $this->actingAs($user)->get('/fusszeile/gestalten')->assertForbidden(); $this->actingAs($user)->postJson('/fusszeile/gestalten/veroeffentlichen')->assertForbidden(); $role = Role::query()->create(['name' => 'Kommunikation']); $role->grants()->create(['ability' => 'appearance.manage']); $editor = User::factory()->withRoles([$role])->create(); $this->actingAs($editor)->postJson('/fusszeile/gestalten/veroeffentlichen', ['content' => $this->content()])->assertOk(); $this->assertTrue(app(Footer::class)->isActive()); $this->actingAs($editor)->get('/admin/startseite-menue/fusszeile')->assertOk()->assertSee('veröffentlicht'); app(Footer::class)->unpublish(); $this->actingAs($user)->get('/')->assertInertia(fn (Assert $p) => $p->where('footerContent', null)); $this->assertCount(1, app(Footer::class)->revisions()); } public function test_homepage_editor_still_works_with_the_shared_base(): void { $admin = User::factory()->admin()->create(); $this->actingAs($admin)->get('/startseite/gestalten')->assertOk()->assertInertia(fn (Assert $p) => $p->where('config.kind', 'homepage')->has('state.mode')); } }