22-05-2026 Optimierung der User und Admin Panels
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
Kevin Adametz 2026-05-22 11:18:59 +02:00
parent d2ba22c0cf
commit e8c47b7553
73 changed files with 10282 additions and 1546 deletions

View file

@ -97,7 +97,7 @@ test('save with all required fields persists the press release and syncs contact
expect($pr->contacts->first()->id)->toBe($contact->id);
});
test('save without a contact id fails validation', function () {
test('save without a contact id succeeds and leaves contacts empty', function () {
/** @var TestCase $this */
$customer = User::factory()->create(['is_active' => true]);
$customer->assignRole('customer');
@ -113,7 +113,28 @@ test('save without a contact id fails validation', function () {
->set('text', str_repeat('x', 60))
->set('categoryId', $category->id)
->call('save', 'draft')
->assertHasErrors(['contactId']);
->assertHasNoErrors(['contactId']);
$pr = PressRelease::query()->where('title', 'Titel mit genug Zeichen')->firstOrFail();
expect($pr->contacts()->count())->toBe(0);
});
test('presubmit check for missing contact is warning, not error', 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);
$component = LivewireVolt::test('customer.press-releases.create')
->set('contactId', null);
$checks = collect($component->instance()->presubmitChecks);
$contactCheck = $checks->firstWhere('key', 'contact');
expect($contactCheck['status'])->toBe('warn');
});
test('boilerplate override is null when toggle is off even if text is filled', function () {