seed(RolesAndPermissionsSeeder::class); }); function makeAdminForShowPhase8a(): User { $admin = User::factory()->create(['is_active' => true]); $admin->assignRole('admin'); return $admin; } test('customer show zeigt den Untertitel direkt unter dem Titel', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'title' => 'Brauerei eröffnet zweiten Standort', 'subtitle' => 'Ein Untertitel der Pressemitteilung', ]); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Brauerei eröffnet zweiten Standort') ->assertSee('Ein Untertitel der Pressemitteilung'); }); test('customer show zeigt geplante Veröffentlichung wenn gesetzt', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'status' => PressReleaseStatus::Review->value, 'scheduled_at' => '2026-07-01 09:30:00', ]); $this->actingAs($customer); // Die App läuft in Europe/Berlin; 09:30 wird unverändert angezeigt. Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Geplante Veröffentlichung') ->assertSee('01.07.2026 09:30'); }); test('customer show zeigt Sperrfrist wenn embargo_at gesetzt', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'status' => PressReleaseStatus::Published->value, 'embargo_at' => '2026-08-15 12:00:00', ]); $this->actingAs($customer); // Die App läuft in Europe/Berlin; 12:00 wird unverändert angezeigt. Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Sperrfrist bis') ->assertSee('15.08.2026 12:00'); }); test('customer show zeigt Kein-Export-Hinweis wenn no_export aktiv', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'no_export' => true, ]); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Kein Export aktiv'); }); test('customer show zeigt Boilerplate-Override als eigene Card', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'boilerplate_override' => 'Über die Beispiel AG: Wir machen Bier seit 1850.', ]); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Eigener Abbinder (Boilerplate)') ->assertSee('Über die Beispiel AG: Wir machen Bier seit 1850.'); }); test('customer show zeigt Boilerplate-Override nicht wenn leer', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'boilerplate_override' => null, ]); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertDontSee('Eigener Abbinder (Boilerplate)'); }); test('customer show links to the public page of a published release', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'status' => PressReleaseStatus::Published, 'published_at' => now()->subHour(), 'slug' => 'oeffentliche-pm', 'language' => 'de', ]); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Öffentlich ansehen') ->assertSee(config('domains.domain_presseecho_url').'/de/press-release/oeffentliche-pm', escape: false); }); test('customer show links to both portals when the release is published on both', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'status' => PressReleaseStatus::Published, 'published_at' => now()->subHour(), 'portal' => Portal::Both, 'slug' => 'beide-portale-pm', 'language' => 'de', ]); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Auf Presseecho ansehen') ->assertSee('Auf Businessportal24 ansehen') ->assertSee(config('domains.domain_presseecho_url').'/de/press-release/beide-portale-pm', escape: false) ->assertSee(config('domains.domain_businessportal_url').'/de/press-release/beide-portale-pm', escape: false); }); test('customer show shows no public link for drafts', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a(); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertDontSee('Öffentlich ansehen'); }); test('admin show zeigt den Untertitel direkt unter dem Titel', function () { /** @var TestCase $this */ $admin = makeAdminForShowPhase8a(); $this->actingAs($admin); $pr = PressRelease::factory()->create([ 'title' => 'Großer Auftritt der Brauerei', 'subtitle' => 'Pressekonferenz am Freitag', ]); Livewire::test('admin.press-releases.show', ['id' => $pr->id]) ->assertSee('Großer Auftritt der Brauerei') ->assertSee('Pressekonferenz am Freitag'); }); test('admin show zeigt Boilerplate-Override als eigene Card', function () { /** @var TestCase $this */ $admin = makeAdminForShowPhase8a(); $this->actingAs($admin); $pr = PressRelease::factory()->create([ 'boilerplate_override' => 'Über das Beispiel-Unternehmen: Mehr Infos folgen.', ]); Livewire::test('admin.press-releases.show', ['id' => $pr->id]) ->assertSee('Eigener Abbinder (Boilerplate)') ->assertSee('Über das Beispiel-Unternehmen: Mehr Infos folgen.'); }); test('admin show zeigt Boilerplate-Override nicht wenn leer', function () { /** @var TestCase $this */ $admin = makeAdminForShowPhase8a(); $this->actingAs($admin); $pr = PressRelease::factory()->create([ 'boilerplate_override' => null, ]); Livewire::test('admin.press-releases.show', ['id' => $pr->id]) ->assertDontSee('Eigener Abbinder (Boilerplate)'); }); test('customer show zeigt das Pruefergebnis und den Qualitaets-Score', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'status' => PressReleaseStatus::Published->value, 'published_at' => now(), 'classification' => PressReleaseClassification::Green->value, 'content_score' => 87, 'content_tier' => PressReleaseContentTier::Hochwertig->value, ]); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Inhaltsprüfung') ->assertSee('Grün') ->assertSee('Qualität') ->assertSee('87') ->assertSee('Hochwertig') ->assertSee('Höchste Stufe erreicht.'); }); test('customer show erklaert bei Gelb den fehlenden Boost neutral', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'status' => PressReleaseStatus::Published->value, 'published_at' => now(), 'classification' => PressReleaseClassification::Yellow->value, ]); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Inhaltsprüfung') ->assertSee('Gelb') ->assertSee('Die Boost-Platzierung ist grün geprüften Meldungen vorbehalten.'); }); test('customer show zeigt ohne Pruefung Ausstehend und kein Qualitaets-Panel', function () { /** @var TestCase $this */ ['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a([ 'classification' => null, 'content_score' => null, ]); $this->actingAs($customer); Livewire::test('customer.press-releases.show', ['id' => $pr->id]) ->assertSee('Inhaltsprüfung') ->assertSee('Ausstehend') ->assertDontSee('Höchste Stufe erreicht.'); });