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:
parent
0efabaf446
commit
a000238ca8
141 changed files with 5922 additions and 1001 deletions
65
tests/Feature/PressReleaseClassificationModelTest.php
Normal file
65
tests/Feature/PressReleaseClassificationModelTest.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\PressReleaseClassification;
|
||||
use App\Models\KiAudit;
|
||||
use App\Models\PressRelease;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
test('press release casts classification to the enum and classified_at to a datetime', function () {
|
||||
$pressRelease = PressRelease::factory()->create([
|
||||
'classification' => PressReleaseClassification::Yellow->value,
|
||||
'classified_at' => now(),
|
||||
]);
|
||||
|
||||
$fresh = $pressRelease->fresh();
|
||||
|
||||
expect($fresh->classification)->toBe(PressReleaseClassification::Yellow);
|
||||
expect($fresh->classified_at)->toBeInstanceOf(Carbon::class);
|
||||
});
|
||||
|
||||
test('classification defaults to null when not set', function () {
|
||||
$pressRelease = PressRelease::factory()->create();
|
||||
|
||||
expect($pressRelease->fresh()->classification)->toBeNull();
|
||||
expect($pressRelease->fresh()->classified_at)->toBeNull();
|
||||
});
|
||||
|
||||
test('press release has many ki audits ordered newest first', function () {
|
||||
$pressRelease = PressRelease::factory()->create();
|
||||
|
||||
$older = KiAudit::factory()->for($pressRelease)->create(['created_at' => now()->subDay()]);
|
||||
$newer = KiAudit::factory()->for($pressRelease)->create(['created_at' => now()]);
|
||||
|
||||
$audits = $pressRelease->kiAudits()->get();
|
||||
|
||||
expect($audits)->toHaveCount(2);
|
||||
expect($audits->first()->id)->toBe($newer->id);
|
||||
expect($audits->last()->id)->toBe($older->id);
|
||||
});
|
||||
|
||||
test('ki audit casts raw_response to an array and belongs to its press release', function () {
|
||||
$pressRelease = PressRelease::factory()->create();
|
||||
$audit = KiAudit::factory()
|
||||
->for($pressRelease)
|
||||
->classification(PressReleaseClassification::Red)
|
||||
->create([
|
||||
'reason' => 'Werbliche Sprache',
|
||||
'raw_response' => ['classification' => 'red', 'reasons' => ['advertising']],
|
||||
]);
|
||||
|
||||
$fresh = $audit->fresh();
|
||||
|
||||
expect($fresh->type)->toBe(KiAudit::TYPE_CLASSIFICATION);
|
||||
expect($fresh->result)->toBe(PressReleaseClassification::Red->value);
|
||||
expect($fresh->raw_response)->toBeArray()->toHaveKey('reasons');
|
||||
expect($fresh->pressRelease->is($pressRelease))->toBeTrue();
|
||||
});
|
||||
|
||||
test('deleting a press release cascades to its ki audits', function () {
|
||||
$pressRelease = PressRelease::factory()->create();
|
||||
KiAudit::factory()->for($pressRelease)->create();
|
||||
|
||||
$pressRelease->forceDelete();
|
||||
|
||||
expect(KiAudit::where('press_release_id', $pressRelease->id)->exists())->toBeFalse();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue