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
|
|
@ -7,6 +7,7 @@ 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;
|
||||
|
||||
|
|
@ -62,6 +63,71 @@ test('changing the company resets the contactId to the new company default', fun
|
|||
->assertSet('contactId', $alphaContact->id);
|
||||
});
|
||||
|
||||
test('company options are limited and searchable', function () {
|
||||
/** @var TestCase $this */
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
$customer->assignRole('customer');
|
||||
|
||||
$companies = Company::factory()
|
||||
->count(12)
|
||||
->presseecho()
|
||||
->sequence(fn (Sequence $sequence): array => [
|
||||
'name' => sprintf('Firma %02d', $sequence->index + 1),
|
||||
])
|
||||
->create();
|
||||
|
||||
$companies->each(fn (Company $company) => $customer->companies()->attach($company->id, ['role' => 'owner']));
|
||||
|
||||
$hiddenCompany = $companies->first();
|
||||
$hiddenCompany->update(['name' => 'Zielunternehmen Spezial']);
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.press-releases.create')
|
||||
->assertViewHas('companyOptions', fn ($companyOptions): bool => $companyOptions->count() === 10
|
||||
&& ! $companyOptions->pluck('id')->contains($hiddenCompany->id))
|
||||
->set('companySearch', 'Zielunternehmen')
|
||||
->assertViewHas('companyOptions', fn ($companyOptions): bool => $companyOptions->count() === 1
|
||||
&& $companyOptions->first()->id === $hiddenCompany->id);
|
||||
});
|
||||
|
||||
test('company options show portal abbreviations for duplicate names', function () {
|
||||
/** @var TestCase $this */
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
$customer->assignRole('customer');
|
||||
|
||||
$presseechoCompany = Company::factory()->presseecho()->create(['name' => 'Doppel GmbH']);
|
||||
$businessportalCompany = Company::factory()->businessportal24()->create(['name' => 'Doppel GmbH']);
|
||||
|
||||
$customer->companies()->attach($presseechoCompany->id, ['role' => 'owner']);
|
||||
$customer->companies()->attach($businessportalCompany->id, ['role' => 'owner']);
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.press-releases.create')
|
||||
->set('companySearch', 'Doppel')
|
||||
->assertSee('Doppel GmbH (PE)')
|
||||
->assertSee('Doppel GmbH (B24)');
|
||||
});
|
||||
|
||||
test('company search ignores trailing portal abbreviation from selected label', function () {
|
||||
/** @var TestCase $this */
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
$customer->assignRole('customer');
|
||||
|
||||
$presseechoCompany = Company::factory()->presseecho()->create(['name' => 'Wein & Würze / N8Schicht GmbH']);
|
||||
$businessportalCompany = Company::factory()->businessportal24()->create(['name' => 'Wein & Würze / N8Schicht GmbH']);
|
||||
|
||||
$customer->companies()->attach($presseechoCompany->id, ['role' => 'owner']);
|
||||
$customer->companies()->attach($businessportalCompany->id, ['role' => 'owner']);
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.press-releases.create')
|
||||
->set('companySearch', 'Wein & Würze / N8Schicht GmbH (B24)')
|
||||
->assertViewHas('companyOptions', fn ($companyOptions): bool => $companyOptions->pluck('id')->contains($businessportalCompany->id));
|
||||
});
|
||||
|
||||
test('save with all required fields persists the press release and syncs contact', function () {
|
||||
/** @var TestCase $this */
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
|
|
@ -163,6 +229,68 @@ test('boilerplate override is null when toggle is off even if text is filled', f
|
|||
expect($pr->boilerplate_override)->toBeNull();
|
||||
});
|
||||
|
||||
test('ensureDraft saves a draft with current data and redirects to the editor', function () {
|
||||
/** @var TestCase $this */
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
$customer->assignRole('customer');
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$customer->companies()->attach($company->id, ['role' => 'owner']);
|
||||
$category = Category::factory()->create();
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.press-releases.create')
|
||||
->set('title', 'Frühzeitiger Upload')
|
||||
->set('categoryId', $category->id)
|
||||
->call('ensureDraft')
|
||||
->assertHasNoErrors();
|
||||
|
||||
$pr = PressRelease::query()->where('user_id', $customer->id)->latest('id')->firstOrFail();
|
||||
|
||||
expect($pr->status)->toBe(PressReleaseStatus::Draft);
|
||||
expect($pr->company_id)->toBe($company->id);
|
||||
expect($pr->category_id)->toBe($category->id);
|
||||
expect($pr->title)->toBe('Frühzeitiger Upload');
|
||||
});
|
||||
|
||||
test('ensureDraft uses a placeholder title when the title is still empty', function () {
|
||||
/** @var TestCase $this */
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
$customer->assignRole('customer');
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$customer->companies()->attach($company->id, ['role' => 'owner']);
|
||||
$category = Category::factory()->create();
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.press-releases.create')
|
||||
->set('categoryId', $category->id)
|
||||
->call('ensureDraft')
|
||||
->assertHasNoErrors();
|
||||
|
||||
$pr = PressRelease::query()->where('user_id', $customer->id)->latest('id')->firstOrFail();
|
||||
|
||||
expect($pr->title)->not->toBe('');
|
||||
expect($pr->status)->toBe(PressReleaseStatus::Draft);
|
||||
});
|
||||
|
||||
test('ensureDraft requires a category before creating a draft', function () {
|
||||
/** @var TestCase $this */
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
$customer->assignRole('customer');
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$customer->companies()->attach($company->id, ['role' => 'owner']);
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.press-releases.create')
|
||||
->set('categoryId', null)
|
||||
->call('ensureDraft')
|
||||
->assertHasErrors(['categoryId']);
|
||||
|
||||
expect(PressRelease::query()->where('user_id', $customer->id)->count())->toBe(0);
|
||||
});
|
||||
|
||||
test('addTag appends to keywords and removeTag drops it', function () {
|
||||
/** @var TestCase $this */
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue