redakteur()->create(); $editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP'); $service = app(PageService::class); Carbon::setTestNow('2026-11-18 08:00:00'); $pages = collect(range(1, 12))->map(fn (int $i) => Page::query()->create(['path' => '/seite-'.$i])); // Die zuerst angelegte Seite wird zuletzt bearbeitet: Sie muss vorn stehen, obwohl sie die kleinste Kennung hat. Carbon::setTestNow('2026-11-18 09:30:00'); $service->saveRevision($pages->first(), [['type' => 'heading', 'v' => 1, 'data' => ['heading' => 'Neu']]], null, null, $editor); $this->assertSame('2026-11-18 09:30:00', $pages->first()->fresh()->updated_at->toDateTimeString()); Livewire::actingAs($editor, 'staff') ->test(ListPages::class) ->assertCanSeeTableRecords($pages->all()) ->assertCanSeeTableRecords([$pages->first(), $pages->last()], inOrder: true) ->assertSee('18.11.2026 10:30', false) ->assertSee('Zuletzt bearbeitet'); } public function test_publishing_also_counts_as_an_edit(): void { Carbon::setTestNow('2026-11-18 08:00:00'); $page = Page::query()->create(['path' => '/veroeffentlichen']); $revision = app(PageService::class)->saveRevision($page, [['type' => 'heading', 'v' => 1, 'data' => ['heading' => 'A']]], null, null, null); Carbon::setTestNow('2026-11-18 11:00:00'); app(PageService::class)->publish($page->fresh(), $revision); $this->assertSame('2026-11-18 11:00:00', $page->fresh()->updated_at->toDateTimeString()); } public function test_first_section_can_start_directly_below_the_header_without_changing_other_spacing(): void { $page = Page::query()->create(['path' => '/abstand']); $service = app(PageService::class); $hero = ['type' => 'hero', 'v' => 2, 'data' => ['heading' => 'Einstieg']]; $revision = $service->saveRevision($page, [ ['layout' => 'u4', 'style' => ['spacing_top' => 'none', 'spacing' => 'large'], 'slots' => [$hero]], ['layout' => 'u4', 'style' => ['spacing_top' => 'small'], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']]]], ['layout' => 'u4', 'style' => [], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Weiter']]]], ], null, null, null); $service->publish($page, $revision); $html = $this->get('/abstand')->assertOk()->getContent(); $this->assertMatchesRegularExpression('#class="page-section section-bg-default section-width-standard section-space-large section-space-top-none section-layout-u4"#', $html); $this->assertStringContainsString('section-space-normal section-space-top-small section-layout-u4', $html); $this->assertSame(2, substr_count($html, 'section-space-top-'), 'Ohne Angabe gilt der normale Abstand; keine zusätzliche Klasse.'); $this->assertSame('same', $revision->sections[2]['style']['spacing_top']); $this->assertStringContainsString('oben kein abstand', SectionStyle::summary($revision->sections[0]['style'])); } public function test_top_spacing_accepts_only_its_enumerated_values(): void { $this->expectException(ValidationException::class); app(PageSections::class)->normalize([ ['layout' => 'u4', 'style' => ['spacing_top' => '0px'], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']]]], ]); } }