'pillar', 'media_card' => 'element', 'program_card' => 'composition'] as $key => $ref) {
$type = $registry->get($key);
$this->assertSame([1, 2, 3, 4], $type->supportedUnits(), $key);
$this->assertSame(['auto', 'fill'], array_keys($type->heights()), $key);
$this->assertSame(['adaptive', 'stacked'], array_keys($type->variants()), $key);
$this->assertSame('widgets.premium_card', $type->view());
$this->assertArrayHasKey($ref, $type->refRules());
$this->assertArrayNotHasKey('url', $type->dataRules(), 'Kein freies Linkziel.');
$this->assertArrayNotHasKey('title', $type->dataRules(), 'Kein eigener Titel: der Titel kommt aus dem Fachobjekt.');
}
$this->assertArrayNotHasKey('show_kind', $registry->get('program_card')->settingOptions(), 'Programm oder Modul bleibt immer benannt.');
}
public function test_topic_card_shows_a_published_theme_from_the_master_data_only(): void
{
$pillar = $this->pillar('Gefühle verstehen', 'gefuehle-verstehen', 'Geschichten und Impulse, die Kinder ins Gespräch bringen.');
$revision = $this->publish('/themenkarte', [$this->section('u2_2', [
$this->card('topic_card', ['pillar' => $pillar->id], settings: ['heading_level' => 'h2', 'show_summary' => 'yes']),
$this->card('topic_card', ['pillar' => $pillar->id], data: ['action_label' => 'Mehr zum Thema'], settings: ['show_summary' => 'no', 'show_kind' => 'no']),
])]);
$this->assertSame(['pillar' => $pillar->id, 'image' => null], $revision->sections[0]['slots'][0]['refs']);
$this->assertStringNotContainsString('Gefühle verstehen', json_encode($revision->sections), 'Keine Kopie des Themennamens im CMS.');
$html = $this->get('/themenkarte')->assertOk()->getContent();
$this->assertStringContainsString('
Gefühle verstehen
', $html);
$this->assertStringContainsString('Gefühle verstehen
', $html);
$this->assertSame(1, substr_count($html, 'Geschichten und Impulse'), 'Kurzbeschreibung nur, wo sie angezeigt werden soll.');
$this->assertStringContainsString('href="'.route('theme', ['slug' => 'gefuehle-verstehen']).'">Thema entdecken', $html);
$this->assertStringContainsString('>Mehr zum Thema', $html);
$this->assertSame(1, substr_count($html, 'Thema
'));
$pillar->update(['name' => 'Gefühle verstehen und benennen']);
$this->get('/themenkarte')->assertSee('Gefühle verstehen und benennen');
$pillar->update(['published_at' => null]);
$this->get('/themenkarte')->assertOk()->assertDontSee('lf-pc', false)->assertDontSee('Gefühle verstehen');
}
public function test_program_card_names_its_kind_and_offers_no_price_or_purchase(): void
{
$module = $this->composition('Modul Nein sagen', 'modul', summary: 'Ein Modul');
$program = $this->composition('Programm Selbstvertrauen', 'programm', summary: 'Ein roter Faden für die Kursgestaltung.');
$revision = $this->publish('/programmkarte', [$this->section('u2_2', [
$this->card('program_card', ['composition' => $program->composition_id]),
$this->card('program_card', ['composition' => $module->composition_id]),
])]);
$html = $this->get('/programmkarte')->assertOk()->getContent();
$this->assertStringContainsString('Programm
', $html);
$this->assertStringContainsString('Programm', $html, 'Ohne Bild trägt die Navy-Tafel die Art.');
$this->assertStringContainsString('href="'.route('public.program', $program->composition_id).'">Programm ansehen', $html);
$this->assertStringContainsString('Ein roter Faden', $html);
$this->assertStringNotContainsString('Modul Nein sagen', $html, 'Module erscheinen öffentlich nicht.');
$this->assertStringNotContainsString('Modul / Programm', $html);
foreach (['€', 'EUR', 'Preis', 'kaufen', 'Warenkorb', '/bereich/angebote', 'offers'] as $commerce) {
$this->assertStringNotContainsString($commerce, $this->mainHtml($html), "Keine Kaufaktion: $commerce");
}
$preview = $this->actingAs(User::factory()->redakteur()->create(), 'staff')->get(route('pages.preview', $revision))->assertOk()->getContent();
$this->assertStringContainsString('Modul
', $preview);
$this->assertStringContainsString('Nur in der Redaktionsvorschau sichtbar: Für Module gibt es noch keine öffentliche Seitenart', $preview);
$this->assertStringContainsString('lf-pc--internal', $preview);
}
public function test_program_card_lists_the_number_of_modules_of_the_shown_version(): void
{
$content = app(ContentService::class);
$moduleA = $this->composition('Modul Eins', 'modul');
$moduleB = $this->composition('Modul Zwei', 'modul');
$composition = $content->createComposition('Programm mit Modulen');
$composition->editorial_content_kind_id = EditorialContentKind::query()->where('slug', 'programm')->value('id');
$composition->save();
$version = $content->publishComposition($composition, [
['role' => 'Modul', 'target' => $moduleA],
['role' => 'Modul', 'target' => $moduleB],
]);
app(CompositionDisplayRelease::class)->release($version, User::factory()->create());
$this->publish('/programm-module', [$this->section('u4', [$this->card('program_card', ['composition' => $composition->id])])]);
$this->get('/programm-module')->assertOk()->assertSee('2 Module', false);
}
public function test_media_card_is_public_only_as_part_of_a_public_program_and_never_releases_the_medium(): void
{
$content = app(ContentService::class);
$film = $content->createElement('film', 'film', 'Denkpause Rohschnitt');
$film->update(['display_title' => 'Eine Pause, die stark macht', 'summary' => 'Gemeinsam innehalten und über gute nächste Schritte sprechen.', 'thumbnail_path' => 'vorschau/denkpause.jpg']);
$filmVersion = $content->publishElementVersion($film, 'Filmbeschreibung');
$sheet = $content->createElement('text', 'pdf', 'Arbeitsblatt intern');
$sheet->update(['editorial_content_kind_id' => EditorialContentKind::query()->where('slug', 'merkblatt')->value('id')]);
$content->publishElementVersion($sheet, 'Inhalt');
$composition = $content->createComposition('Programm Denkpause');
$composition->editorial_content_kind_id = EditorialContentKind::query()->where('slug', 'programm')->value('id');
$composition->save();
$version = $content->publishComposition($composition, [['role' => 'Film', 'target' => $filmVersion]]);
app(CompositionDisplayRelease::class)->release($version, User::factory()->create());
$revision = $this->publish('/medienkarte', [$this->section('u2_2', [
$this->card('media_card', ['element' => $film->id], data: ['note' => 'Für die nächste Kursstunde.']),
$this->card('media_card', ['element' => $sheet->id]),
])]);
$html = $this->get('/medienkarte')->assertOk()->getContent();
$main = $this->mainHtml($html);
$this->assertStringContainsString('Eine Pause, die stark macht', $main);
$this->assertStringContainsString('Film
', $main);
$this->assertStringContainsString('Im Programm „Programm Denkpause“', $main);
$this->assertStringContainsString('href="'.route('public.program', $composition->id).'">Im Programm ansehen', $main);
$this->assertStringContainsString('Für die nächste Kursstunde.', $main);
$this->assertStringNotContainsString('Arbeitsblatt intern', $main, 'Nicht Teil eines öffentlichen Programms: öffentlich nicht sichtbar.');
foreach (['vorschau/denkpause.jpg', '/bereich/', '/redaktion/', '/ausgabe/', '