User Panel: Phase-8-Abschluss, Titelbild/Lizenzen/Zeitzonen und KI-Pruef-Pipeline

Phase 8 (Rest) + Umbauten vom 10./11.06.:
- Ein Titelbild pro PM (Cover 1280x580), SVG-Platzhalter-Set + Picker,
  PressReleaseCoverImage-Resolver
- Lizenz-/Rechteformular nach "Lizenztyp Bildupload" (7 Lizenztypen,
  Personen-/Sachrechte-Status, bedingte Pflichtfelder, Risikohinweise)
- Veroeffentlichungs-Box vereinfacht (Embargo aus der Form-UI entfernt),
  geplante Termine in Europe/Berlin (Speicherung UTC, DISPLAY_TIMEZONE)
- Quota-Stub (users.press_release_quota) + monatlicher Reset-Command
- Einreichungs-Modal einheitlich in Show/Create/Edit; Ghost-Buttons auf
  filled; PM-Editor-Layout responsive entkoppelt (.pr-editor-layout)

KI-Pruef-Pipeline (Phasen 1-5 des Entwicklungsplans):
- API-Haertung: status nicht mehr per API setzbar, eigene Submit-Route
  durch denselben Funnel (Blacklist, Quota, Status-Log)
- Klassifikation Rot/Gelb/Gruen asynchron (Queue classification,
  OpenAI-Treiber + deterministischer Fallback), ki_audits-Audit-Log
- Routing: Rot -> rejected + Mail, Gelb -> Review-Queue, Gruen ->
  Auto-Publish; Scheduler publiziert nur gruene faellige PMs
- Content-Score 0-100 -> Stufe (Standard/Geprueft/Hochwertig) inkl.
  Editor-Panel und Badges; Re-Klassifikation/-Score bei Aenderung
- Admin: KI-Badge + Filter, On-Demand-Pruefung mit Anbieter-Override

Suite: 442 passed, 4 skipped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-06-12 08:30:13 +00:00
parent 0efabaf446
commit a000238ca8
141 changed files with 5922 additions and 1001 deletions

View file

@ -1,11 +1,14 @@
<?php
use App\Enums\ImageLicenseType;
use App\Enums\PressReleaseContentTier;
use App\Models\Category;
use App\Models\Company;
use App\Models\Contact;
use App\Models\PressRelease;
use App\Models\User;
use Database\Seeders\RolesAndPermissionsSeeder;
use Illuminate\Database\Eloquent\Factories\Sequence;
use Livewire\Volt\Volt as LivewireVolt;
use Tests\TestCase;
@ -40,6 +43,22 @@ function makeCustomerWithPressRelease(array $prAttributes = []): array
return compact('customer', 'company', 'contact', 'category', 'pr');
}
test('editor shows the content score panel when a score exists', function () {
/** @var TestCase $this */
['customer' => $customer, 'pr' => $pr] = makeCustomerWithPressRelease([
'content_score' => 67,
'content_tier' => PressReleaseContentTier::Geprueft->value,
]);
$this->actingAs($customer);
LivewireVolt::test('customer.press-releases.edit', ['id' => $pr->id])
->assertSet('contentScore', 67)
->assertSee('67')
->assertSee('Geprüft')
->assertSee('Noch 13 Punkte bis zur nächsten Stufe.');
});
test('mount loads all Phase 7 fields and pivot contact', function () {
/** @var TestCase $this */
['customer' => $customer, 'pr' => $pr, 'contact' => $contact] = makeCustomerWithPressRelease([
@ -71,6 +90,30 @@ test('mount falls back to first company contact when no pivot exists', function
->assertSet('contactId', $contact->id);
});
test('edit page shows uploaded title image instead of placeholder controls', function () {
/** @var TestCase $this */
['customer' => $customer, 'pr' => $pr] = makeCustomerWithPressRelease([
'title' => 'PM mit eigenem Titelbild',
]);
$pr->images()->create([
'disk' => 'public',
'path' => 'press-releases/'.$pr->id.'/images/title.jpg',
'variants' => ['cover' => 'press-releases/'.$pr->id.'/images/title-cover.jpg'],
'author' => 'Jane Doe',
'license_type' => ImageLicenseType::Own->value,
'rights_confirmed_at' => now(),
'is_preview' => true,
'sort_order' => 1,
]);
$this->actingAs($customer);
LivewireVolt::test('customer.press-releases.edit', ['id' => $pr->id])
->assertDontSee('Dieser Platzhalter wird angezeigt, bis ein eigenes Titelbild hochgeladen ist.')
->assertDontSee('Platzhalter wählen');
});
test('save persists all new Phase 7 fields and syncs contact', function () {
/** @var TestCase $this */
['customer' => $customer, 'pr' => $pr] = makeCustomerWithPressRelease();
@ -150,6 +193,33 @@ test('changing the company resets the contact to the new company default', funct
->assertSet('contactId', $secondContact->id);
});
test('company options keep selected company and search without loading all companies', function () {
/** @var TestCase $this */
['customer' => $customer, 'pr' => $pr, 'company' => $selectedCompany] = makeCustomerWithPressRelease();
$companies = Company::factory()
->count(12)
->presseecho()
->sequence(fn (Sequence $sequence): array => [
'name' => sprintf('Weitere Firma %02d', $sequence->index + 1),
])
->create();
$companies->each(fn (Company $company) => $customer->companies()->attach($company->id, ['role' => 'owner']));
$targetCompany = $companies->first();
$targetCompany->update(['name' => 'Suchtreffer Redaktion']);
$this->actingAs($customer);
LivewireVolt::test('customer.press-releases.edit', ['id' => $pr->id])
->assertViewHas('companyOptions', fn ($companyOptions): bool => $companyOptions->count() === 10
&& $companyOptions->pluck('id')->contains($selectedCompany->id))
->set('companySearch', 'Suchtreffer')
->assertViewHas('companyOptions', fn ($companyOptions): bool => $companyOptions->count() === 1
&& $companyOptions->first()->id === $targetCompany->id);
});
test('rejected press releases can be edited and re-submitted', function () {
/** @var TestCase $this */
['customer' => $customer, 'pr' => $pr] = makeCustomerWithPressRelease([