- 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>
253 lines
8 KiB
PHP
253 lines
8 KiB
PHP
<?php
|
|
|
|
use App\Enums\PressReleaseClassification;
|
|
use App\Enums\PressReleaseContentTier;
|
|
use App\Enums\PressReleaseStatus;
|
|
use App\Models\Company;
|
|
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 makeCustomerForIndexPhase8b(): User
|
|
{
|
|
$customer = User::factory()->create(['is_active' => true]);
|
|
$customer->assignRole('customer');
|
|
|
|
return $customer;
|
|
}
|
|
|
|
function makeAdminForIndexPhase8b(): User
|
|
{
|
|
$admin = User::factory()->create(['is_active' => true]);
|
|
$admin->assignRole('admin');
|
|
|
|
return $admin;
|
|
}
|
|
|
|
test('customer list zeigt Scheduling-Sub-Zeile bei review-PMs mit scheduled_at', function () {
|
|
/** @var TestCase $this */
|
|
$customer = makeCustomerForIndexPhase8b();
|
|
$this->actingAs($customer);
|
|
|
|
$company = Company::factory()->presseecho()->create();
|
|
$customer->companies()->attach($company->id, ['role' => 'owner']);
|
|
|
|
PressRelease::factory()->create([
|
|
'user_id' => $customer->id,
|
|
'company_id' => $company->id,
|
|
'portal' => $company->portal->value,
|
|
'status' => PressReleaseStatus::Review->value,
|
|
'scheduled_at' => now()->addDays(3)->setTime(14, 30),
|
|
]);
|
|
|
|
Livewire::test('customer.press-releases.index')
|
|
->assertSee('geplant');
|
|
});
|
|
|
|
test('customer list zeigt Embargo-Sub-Zeile bei PMs mit embargo_at in der Zukunft', function () {
|
|
/** @var TestCase $this */
|
|
$customer = makeCustomerForIndexPhase8b();
|
|
$this->actingAs($customer);
|
|
|
|
$company = Company::factory()->presseecho()->create();
|
|
$customer->companies()->attach($company->id, ['role' => 'owner']);
|
|
|
|
PressRelease::factory()->create([
|
|
'user_id' => $customer->id,
|
|
'company_id' => $company->id,
|
|
'portal' => $company->portal->value,
|
|
'status' => PressReleaseStatus::Published->value,
|
|
'embargo_at' => now()->addDays(7),
|
|
]);
|
|
|
|
Livewire::test('customer.press-releases.index')
|
|
->assertSee('Embargo bis');
|
|
});
|
|
|
|
test('customer list zeigt KEINE Scheduling-Sub-Zeile wenn scheduled_at in der Vergangenheit', function () {
|
|
/** @var TestCase $this */
|
|
$customer = makeCustomerForIndexPhase8b();
|
|
$this->actingAs($customer);
|
|
|
|
$company = Company::factory()->presseecho()->create();
|
|
$customer->companies()->attach($company->id, ['role' => 'owner']);
|
|
|
|
PressRelease::factory()->create([
|
|
'user_id' => $customer->id,
|
|
'company_id' => $company->id,
|
|
'portal' => $company->portal->value,
|
|
'status' => PressReleaseStatus::Published->value,
|
|
'scheduled_at' => now()->subDay(),
|
|
]);
|
|
|
|
Livewire::test('customer.press-releases.index')
|
|
->assertDontSee('geplant ·');
|
|
});
|
|
|
|
test('customer list zeigt KEINE Embargo-Sub-Zeile wenn embargo_at abgelaufen', function () {
|
|
/** @var TestCase $this */
|
|
$customer = makeCustomerForIndexPhase8b();
|
|
$this->actingAs($customer);
|
|
|
|
$company = Company::factory()->presseecho()->create();
|
|
$customer->companies()->attach($company->id, ['role' => 'owner']);
|
|
|
|
PressRelease::factory()->create([
|
|
'user_id' => $customer->id,
|
|
'company_id' => $company->id,
|
|
'portal' => $company->portal->value,
|
|
'status' => PressReleaseStatus::Published->value,
|
|
'embargo_at' => now()->subDay(),
|
|
]);
|
|
|
|
Livewire::test('customer.press-releases.index')
|
|
->assertDontSee('Embargo bis');
|
|
});
|
|
|
|
test('admin list zeigt Scheduling-Sub-Zeile bei review-PMs mit scheduled_at', function () {
|
|
/** @var TestCase $this */
|
|
$admin = makeAdminForIndexPhase8b();
|
|
$this->actingAs($admin);
|
|
|
|
PressRelease::factory()->create([
|
|
'status' => PressReleaseStatus::Review->value,
|
|
'scheduled_at' => now()->addDays(2)->setTime(10, 0),
|
|
]);
|
|
|
|
Livewire::test('admin.press-releases.index')
|
|
->assertSee('geplant');
|
|
});
|
|
|
|
test('admin list zeigt Embargo-Sub-Zeile bei PMs mit embargo_at in der Zukunft', function () {
|
|
/** @var TestCase $this */
|
|
$admin = makeAdminForIndexPhase8b();
|
|
$this->actingAs($admin);
|
|
|
|
PressRelease::factory()->create([
|
|
'status' => PressReleaseStatus::Published->value,
|
|
'embargo_at' => now()->addDays(5),
|
|
]);
|
|
|
|
Livewire::test('admin.press-releases.index')
|
|
->assertSee('Embargo bis');
|
|
});
|
|
|
|
test('admin list zeigt KEINE Sub-Zeilen wenn weder scheduled_at noch embargo_at', function () {
|
|
/** @var TestCase $this */
|
|
$admin = makeAdminForIndexPhase8b();
|
|
$this->actingAs($admin);
|
|
|
|
PressRelease::factory()->create([
|
|
'status' => PressReleaseStatus::Draft->value,
|
|
'scheduled_at' => null,
|
|
'embargo_at' => null,
|
|
]);
|
|
|
|
Livewire::test('admin.press-releases.index')
|
|
->assertDontSee('geplant ·')
|
|
->assertDontSee('Embargo bis');
|
|
});
|
|
|
|
test('admin list zeigt Content-Score-Stufe', function () {
|
|
/** @var TestCase $this */
|
|
$admin = makeAdminForIndexPhase8b();
|
|
$this->actingAs($admin);
|
|
|
|
PressRelease::factory()->create([
|
|
'status' => PressReleaseStatus::Published->value,
|
|
'content_score' => 84,
|
|
'content_tier' => PressReleaseContentTier::Hochwertig->value,
|
|
]);
|
|
|
|
Livewire::test('admin.press-releases.index')
|
|
->assertSee('84 · Hochwertig');
|
|
});
|
|
|
|
test('admin list zeigt KI-Klassifikations-Badge', function () {
|
|
/** @var TestCase $this */
|
|
$admin = makeAdminForIndexPhase8b();
|
|
$this->actingAs($admin);
|
|
|
|
PressRelease::factory()->create([
|
|
'status' => PressReleaseStatus::Review->value,
|
|
'classification' => PressReleaseClassification::Yellow->value,
|
|
]);
|
|
|
|
Livewire::test('admin.press-releases.index')
|
|
->assertSee('KI: Gelb');
|
|
});
|
|
|
|
test('admin list filtert nach KI-Klassifikation', function () {
|
|
/** @var TestCase $this */
|
|
$admin = makeAdminForIndexPhase8b();
|
|
$this->actingAs($admin);
|
|
|
|
$yellow = PressRelease::factory()->create([
|
|
'status' => PressReleaseStatus::Review->value,
|
|
'classification' => PressReleaseClassification::Yellow->value,
|
|
'title' => 'Gelber Grenzfall',
|
|
]);
|
|
$green = PressRelease::factory()->create([
|
|
'status' => PressReleaseStatus::Review->value,
|
|
'classification' => PressReleaseClassification::Green->value,
|
|
'title' => 'Grüne Mitteilung',
|
|
]);
|
|
|
|
Livewire::test('admin.press-releases.index')
|
|
->set('classificationFilter', PressReleaseClassification::Yellow->value)
|
|
->assertSee('Gelber Grenzfall')
|
|
->assertDontSee('Grüne Mitteilung');
|
|
});
|
|
|
|
test('customer list zeigt das Titelbild als Thumbnail in der Bild-Spalte', function () {
|
|
/** @var TestCase $this */
|
|
$customer = makeCustomerForIndexPhase8b();
|
|
$this->actingAs($customer);
|
|
|
|
$pr = PressRelease::factory()->create([
|
|
'user_id' => $customer->id,
|
|
'title' => 'PM mit Titelbild',
|
|
]);
|
|
// Zweitbild zuerst angelegt — das Titelbild (is_preview) muss trotzdem gewinnen.
|
|
$pr->images()->create([
|
|
'disk' => 'public',
|
|
'path' => 'press/second.jpg',
|
|
'variants' => ['thumb' => 'press/second-thumb.jpg'],
|
|
'is_preview' => false,
|
|
'sort_order' => 2,
|
|
]);
|
|
$pr->images()->create([
|
|
'disk' => 'public',
|
|
'path' => 'press/cover.jpg',
|
|
'variants' => ['thumb' => 'press/cover-thumb.jpg'],
|
|
'is_preview' => true,
|
|
'sort_order' => 1,
|
|
]);
|
|
|
|
Livewire::test('customer.press-releases.index')
|
|
->assertSee('Bild')
|
|
->assertSee('storage/press/cover-thumb.jpg', false)
|
|
->assertDontSee('storage/press/second-thumb.jpg', false);
|
|
});
|
|
|
|
test('customer list zeigt den gewählten Platzhalter als Thumbnail bei bildlosen PMs', function () {
|
|
/** @var TestCase $this */
|
|
$customer = makeCustomerForIndexPhase8b();
|
|
$this->actingAs($customer);
|
|
|
|
PressRelease::factory()->create([
|
|
'user_id' => $customer->id,
|
|
'title' => 'PM ohne Bild',
|
|
'placeholder_variant' => '05-lines-green',
|
|
]);
|
|
|
|
Livewire::test('customer.press-releases.index')
|
|
->assertSee('press-release-placeholders/05-lines-green.svg', false);
|
|
});
|