presseportale/tests/Feature/PressReleaseShowPhase8aTest.php
Kevin Adametz 31da9ea8b6
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
livewire: Volt entfernt — Komponenten als Livewire-4-Single-File-Components, Route::livewire(), Livewire::test(); livewire/volt deinstalliert
- 83 Komponenten: Livewire\Volt\Component → Livewire\Component
- 73 Routen (admin, auth, customer): Volt::route() → Route::livewire()
- 88 Testdateien: Volt::test/actingAs → Livewire::test/actingAs
- VoltServiceProvider gelöscht; composer remove livewire/volt
- config/livewire.php auf v4-Schlüssel (component_layout, component_placeholder,
  component_locations, make_command: SFC ohne ⚡). Der alte Schlüssel layout war
  wirkungslos; alle gerouteten Komponenten setzen ihr Layout selbst.
- CLAUDE.md, AGENTS.md, boost.json, .cursorrules, Skill volt-development
- Roadmap: erledigt; Larastan erfasst SFCs weiterhin nicht (Blade-Dateien)

Suite 2.325 grün, einer übersprungen; Larastan und Pint ohne Meldung;
route:cache und view:cache laufen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:59:36 +00:00

232 lines
8.4 KiB
PHP

<?php
use App\Enums\Portal;
use App\Enums\PressReleaseClassification;
use App\Enums\PressReleaseContentTier;
use App\Enums\PressReleaseStatus;
use App\Models\PressRelease;
use App\Models\User;
use Database\Seeders\RolesAndPermissionsSeeder;
use Livewire\Livewire;
use Tests\TestCase;
beforeEach(function (): void {
/** @var TestCase $this */
$this->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.');
});