*/ private function prose(string $text): array { return ['type' => 'prose', 'v' => 1, 'data' => ['body' => $text]]; } /** * @return array */ private function heading(string $text): array { return ['type' => 'heading', 'v' => 1, 'data' => ['heading' => $text]]; } /** * @return list> */ private function matrix(): array { $sections = []; foreach (['default' => ['narrow', 'standard', 'wide', 'full'], 'light' => ['wide'], 'dark' => ['narrow', 'standard', 'wide', 'full'], 'accent' => ['wide']] as $background => $widths) { foreach ($widths as $width) { $sections[] = [ 'layout' => 'u2_2', 'style' => ['background' => $background, 'width' => $width], 'slots' => [$this->heading("$background $width"), $this->prose("Text $background $width")], ]; } } foreach (['light', 'dark', 'none'] as $overlay) { foreach (['center', 'top_left'] as $focus) { $sections[] = [ 'layout' => 'u4', 'style' => ['background' => 'image', 'image' => 'cms/flaeche.jpg', 'focus' => $focus, 'overlay' => $overlay], 'slots' => [$this->prose("Bild $overlay $focus")], ]; } } foreach (['none', 'compact', 'normal', 'large'] as $spacing) { $sections[] = [ 'layout' => 'u1_3', 'style' => ['background' => 'light', 'spacing_top' => $spacing, 'spacing_bottom' => $spacing, 'gap' => $spacing, 'divider' => 'line'], 'slots' => [$this->prose("Abstand $spacing"), $this->prose('Rechts')], ]; } $sections[] = ['layout' => 'u4', 'style' => ['background' => 'dark', 'divider' => 'accent'], 'slots' => [$this->heading('Trenner Akzent')]]; $sections[] = ['layout' => 'u4', 'style' => ['cards_height' => 'equal', 'cards_links' => 'bottom'], 'slots' => [$this->prose('Karten gleich hoch')]]; $sections[] = ['layout' => 'u1_1_1_1', 'style' => ['background' => 'accent'], 'slots' => [$this->prose('Eins'), null, $this->prose('Drei'), null]]; return $sections; } /** * Zufällige Kennungen (Abschnitt, Widget) werden für den Vergleich vereinheitlicht. */ private function sectionsMarkup(string $html): string { $start = strpos($html, '
create(['path' => '/legacy']); $service->publish($page, $service->saveRevision($page, $this->matrix(), null, null, null)); $markup = $this->sectionsMarkup($this->get('/legacy')->assertOk()->getContent()); if (getenv('UPDATE_SNAPSHOT') === '1') { file_put_contents(self::FIXTURE, $markup); } $this->assertFileExists(self::FIXTURE); $this->assertSame(file_get_contents(self::FIXTURE), $markup, 'Die Ausgabe bestehender Abschnittsvarianten hat sich geändert.'); } }