22-05-2026 Optimierung der User und Admin Panels
This commit is contained in:
parent
d2ba22c0cf
commit
e8c47b7553
73 changed files with 10282 additions and 1546 deletions
|
|
@ -102,10 +102,70 @@ test('admin opens generated legacy invoice pdf inline', function () {
|
|||
LivewireVolt::test('admin.invoices.index')
|
||||
->assertSee('Öffnen');
|
||||
|
||||
$this->get(route('admin.legacy-invoices.pdf', $invoice))
|
||||
$response = $this->get(route('admin.legacy-invoices.pdf', $invoice));
|
||||
|
||||
$response
|
||||
->assertSuccessful()
|
||||
->assertHeader('content-type', 'application/pdf')
|
||||
->assertHeader('content-disposition', 'inline; filename="Presseecho-RNr-PE-2003.pdf"');
|
||||
|
||||
expect($response->content())
|
||||
->toContain('adametz.media')
|
||||
->toContain('Rechnungsbetrag')
|
||||
->toContain('/F2 21 Tf');
|
||||
|
||||
expect($invoice->refresh()->pdf_generated_at)->not->toBeNull();
|
||||
});
|
||||
|
||||
test('admin opens legacy invoice pdf with stern layout for non media invoices', function () {
|
||||
/** @var TestCase $this */
|
||||
$invoice = LegacyInvoice::query()->create([
|
||||
'legacy_portal' => 'businessportal24',
|
||||
'legacy_id' => 2004,
|
||||
'user_id' => null,
|
||||
'legacy_user_id' => 504,
|
||||
'number' => 'BP-2004',
|
||||
'amount_cents' => 11900,
|
||||
'total_cents' => 11900,
|
||||
'status' => 'open',
|
||||
'invoice_date' => now()->subMonth(),
|
||||
'due_date' => now()->addDays(14),
|
||||
'payment_method' => 'invoice',
|
||||
'raw_snapshot' => [
|
||||
'number' => 'BP-2004',
|
||||
'is_media' => false,
|
||||
'service_period_begin_date' => now()->subYear()->toDateString(),
|
||||
'service_period_end_date' => now()->toDateString(),
|
||||
],
|
||||
'pdf_payload' => [
|
||||
'invoice' => [
|
||||
'is_media' => false,
|
||||
'service_period_begin_date' => now()->subYear()->toDateString(),
|
||||
'service_period_end_date' => now()->toDateString(),
|
||||
],
|
||||
'billing_address' => [
|
||||
'name' => 'Stern Archiv GmbH',
|
||||
'address' => 'Archivstrasse 2',
|
||||
'postal_code' => '10719',
|
||||
'city' => 'Berlin',
|
||||
'country_name' => 'Deutschland',
|
||||
],
|
||||
'payment_option_translation' => [
|
||||
'name' => 'Legacy Pressepaket',
|
||||
],
|
||||
],
|
||||
'imported_at' => now(),
|
||||
]);
|
||||
|
||||
$response = $this->get(route('admin.legacy-invoices.pdf', $invoice));
|
||||
|
||||
$response
|
||||
->assertSuccessful()
|
||||
->assertHeader('content-type', 'application/pdf')
|
||||
->assertHeader('content-disposition', 'inline; filename="Businessportal24-RNr-BP-2004.pdf"');
|
||||
|
||||
expect($response->content())
|
||||
->toContain('Stern Consulting GmbH')
|
||||
->toContain('Hypo Vereinsbank')
|
||||
->toContain('/F2 19 Tf');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -95,8 +95,7 @@ test('admin can change archived press release back to another status', function
|
|||
LivewireVolt::test('admin.press-releases.edit', ['id' => $pressRelease->id])
|
||||
->set('targetStatus', PressReleaseStatus::Draft->value)
|
||||
->call('changeStatus')
|
||||
->assertHasNoErrors()
|
||||
->assertSee('Status wurde auf');
|
||||
->assertHasNoErrors();
|
||||
|
||||
$pressRelease->refresh();
|
||||
|
||||
|
|
|
|||
217
tests/Feature/Admin/AdminPressReleaseFormFieldsTest.php
Normal file
217
tests/Feature/Admin/AdminPressReleaseFormFieldsTest.php
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
<?php
|
||||
|
||||
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 Livewire\Volt\Volt as LivewireVolt;
|
||||
use Tests\TestCase;
|
||||
|
||||
beforeEach(function (): void {
|
||||
/** @var TestCase $this */
|
||||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
});
|
||||
|
||||
function makeFieldsAdmin(): User
|
||||
{
|
||||
$admin = User::factory()->create(['is_active' => true]);
|
||||
$admin->assignRole('admin');
|
||||
|
||||
return $admin;
|
||||
}
|
||||
|
||||
test('admin create persistiert subtitle und boilerplate_override', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeFieldsAdmin();
|
||||
$company = Company::factory()->presseecho()->create([
|
||||
'boilerplate' => 'Firmen-Boilerplate (default).',
|
||||
]);
|
||||
$category = Category::factory()->create();
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.create')
|
||||
->set('companyId', $company->id)
|
||||
->set('portal', $company->portal->value)
|
||||
->set('categoryId', $category->id)
|
||||
->set('title', 'PM mit Subtitle und Boilerplate')
|
||||
->set('subtitle', 'Eine knackige Dachzeile als Untertitel.')
|
||||
->set('text', str_repeat('Inhalt eines Tests mit ausreichend Länge. ', 5))
|
||||
->set('useBoilerplateOverride', true)
|
||||
->set('boilerplateOverride', 'Override-Boilerplate nur für diese PM.')
|
||||
->call('save')
|
||||
->assertHasNoErrors();
|
||||
|
||||
$pr = PressRelease::query()->latest('id')->firstOrFail();
|
||||
|
||||
expect($pr->subtitle)->toBe('Eine knackige Dachzeile als Untertitel.');
|
||||
expect($pr->boilerplate_override)->toBe('Override-Boilerplate nur für diese PM.');
|
||||
});
|
||||
|
||||
test('admin create syncht ausgewählten Pressekontakt mit der PM', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeFieldsAdmin();
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$contact = Contact::factory()->for($company)->create([
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Mustermann',
|
||||
'portal' => $company->portal->value,
|
||||
]);
|
||||
$category = Category::factory()->create();
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.create')
|
||||
->set('companyId', $company->id)
|
||||
->set('portal', $company->portal->value)
|
||||
->set('categoryId', $category->id)
|
||||
->set('title', 'PM mit Kontakt')
|
||||
->set('text', str_repeat('Inhalt eines Tests. ', 5))
|
||||
->set('contactId', $contact->id)
|
||||
->call('save')
|
||||
->assertHasNoErrors();
|
||||
|
||||
$pr = PressRelease::query()->latest('id')->firstOrFail();
|
||||
|
||||
expect($pr->contacts()->pluck('contacts.id')->all())->toBe([$contact->id]);
|
||||
});
|
||||
|
||||
test('admin create setzt default-Kontakt beim Firma-Wechsel', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeFieldsAdmin();
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$contact = Contact::factory()->for($company)->create([
|
||||
'first_name' => 'Anna',
|
||||
'last_name' => 'Aaron',
|
||||
'portal' => $company->portal->value,
|
||||
]);
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.create')
|
||||
->set('companyId', $company->id)
|
||||
->assertSet('contactId', $contact->id);
|
||||
});
|
||||
|
||||
test('admin create addTag und removeTag schreiben keywords kommagetrennt', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeFieldsAdmin();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$component = LivewireVolt::test('admin.press-releases.create')
|
||||
->call('addTag', 'Innovation')
|
||||
->call('addTag', 'Mittelstand')
|
||||
->call('addTag', 'Innovation')
|
||||
->assertSet('keywords', 'Innovation, Mittelstand');
|
||||
|
||||
$component->call('removeTag', 'Innovation')
|
||||
->assertSet('keywords', 'Mittelstand');
|
||||
});
|
||||
|
||||
test('admin create lehnt zu langen Subtitle ab', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeFieldsAdmin();
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$category = Category::factory()->create();
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.create')
|
||||
->set('companyId', $company->id)
|
||||
->set('portal', $company->portal->value)
|
||||
->set('categoryId', $category->id)
|
||||
->set('title', 'Gültiger Titel hier')
|
||||
->set('subtitle', str_repeat('a', 300))
|
||||
->set('text', str_repeat('Inhalt eines Tests. ', 5))
|
||||
->call('save')
|
||||
->assertHasErrors(['subtitle']);
|
||||
});
|
||||
|
||||
test('admin edit hydratisiert subtitle, boilerplate_override und Kontakt', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeFieldsAdmin();
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$contact = Contact::factory()->for($company)->create([
|
||||
'first_name' => 'Pia',
|
||||
'last_name' => 'Presse',
|
||||
'portal' => $company->portal->value,
|
||||
]);
|
||||
|
||||
$pr = PressRelease::factory()->create([
|
||||
'company_id' => $company->id,
|
||||
'subtitle' => 'Hydrierter Untertitel.',
|
||||
'boilerplate_override' => 'Hydrierte Override-Boilerplate.',
|
||||
]);
|
||||
$pr->contacts()->sync([$contact->id]);
|
||||
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.edit', ['id' => $pr->id])
|
||||
->assertSet('subtitle', 'Hydrierter Untertitel.')
|
||||
->assertSet('boilerplateOverride', 'Hydrierte Override-Boilerplate.')
|
||||
->assertSet('useBoilerplateOverride', true)
|
||||
->assertSet('contactId', $contact->id);
|
||||
});
|
||||
|
||||
test('admin edit speichert subtitle, boilerplate_override und Kontakt', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeFieldsAdmin();
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$contact = Contact::factory()->for($company)->create([
|
||||
'portal' => $company->portal->value,
|
||||
]);
|
||||
|
||||
$pr = PressRelease::factory()->create([
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.edit', ['id' => $pr->id])
|
||||
->set('subtitle', 'Neuer Untertitel beim Bearbeiten.')
|
||||
->set('useBoilerplateOverride', true)
|
||||
->set('boilerplateOverride', 'Neue Override-Boilerplate beim Bearbeiten.')
|
||||
->set('contactId', $contact->id)
|
||||
->call('save')
|
||||
->assertHasNoErrors();
|
||||
|
||||
$pr->refresh();
|
||||
expect($pr->subtitle)->toBe('Neuer Untertitel beim Bearbeiten.');
|
||||
expect($pr->boilerplate_override)->toBe('Neue Override-Boilerplate beim Bearbeiten.');
|
||||
expect($pr->contacts()->pluck('contacts.id')->all())->toBe([$contact->id]);
|
||||
});
|
||||
|
||||
test('admin edit zeigt Pre-Submit-Check-Berechnungen', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeFieldsAdmin();
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$category = Category::factory()->create();
|
||||
|
||||
$pr = PressRelease::factory()->create([
|
||||
'company_id' => $company->id,
|
||||
'category_id' => $category->id,
|
||||
'title' => 'Vollständiger Titel mit ausreichend Zeichen für ok-Status',
|
||||
'text' => str_repeat('Inhalt eines Tests mit ausreichend Länge. ', 25),
|
||||
]);
|
||||
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.edit', ['id' => $pr->id])
|
||||
->assertSee('Pre-Submit-Check')
|
||||
->assertSee('Titel vorhanden')
|
||||
->assertSee('Mindestlänge Fließtext erreicht')
|
||||
->assertSee('Firma zugeordnet')
|
||||
->assertSee('Kategorie gewählt')
|
||||
->assertSee('Pressekontakt zugeordnet')
|
||||
->assertSee('Themen-Tags vergeben');
|
||||
});
|
||||
|
||||
test('admin edit zeigt Untertitel-Feld', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeFieldsAdmin();
|
||||
$pr = PressRelease::factory()->create();
|
||||
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.edit', ['id' => $pr->id])
|
||||
->assertSee('Untertitel')
|
||||
->assertSee('Themen-Tags');
|
||||
});
|
||||
141
tests/Feature/Admin/AdminPressReleaseSchedulingTest.php
Normal file
141
tests/Feature/Admin/AdminPressReleaseSchedulingTest.php
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use App\Models\User;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Livewire\Volt\Volt as LivewireVolt;
|
||||
use Tests\TestCase;
|
||||
|
||||
beforeEach(function (): void {
|
||||
/** @var TestCase $this */
|
||||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
});
|
||||
|
||||
function makeAdmin(): User
|
||||
{
|
||||
$admin = User::factory()->create(['is_active' => true]);
|
||||
$admin->assignRole('admin');
|
||||
|
||||
return $admin;
|
||||
}
|
||||
|
||||
test('admin create form persistiert scheduled_at und embargo_at', function () {
|
||||
/** @var TestCase $this */
|
||||
Carbon::setTestNow('2026-06-01 10:00:00');
|
||||
|
||||
$admin = makeAdmin();
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$category = Category::factory()->create();
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.create')
|
||||
->set('title', 'Admin Scheduled PM')
|
||||
->set('text', str_repeat('Inhalt eines Tests. ', 5))
|
||||
->set('companyId', $company->id)
|
||||
->set('categoryId', $category->id)
|
||||
->set('portal', $company->portal->value)
|
||||
->set('publishMode', 'scheduled')
|
||||
->set('scheduledAt', '2026-06-05T14:30')
|
||||
->set('useEmbargo', true)
|
||||
->set('embargoAt', '2026-06-10T08:00')
|
||||
->call('save')
|
||||
->assertHasNoErrors();
|
||||
|
||||
$pr = PressRelease::query()->latest('id')->firstOrFail();
|
||||
|
||||
expect($pr->scheduled_at?->toDateTimeString())->toBe('2026-06-05 14:30:00');
|
||||
expect($pr->embargo_at?->toDateTimeString())->toBe('2026-06-10 08:00:00');
|
||||
});
|
||||
|
||||
test('admin create form lehnt scheduled_at in der Vergangenheit ab', function () {
|
||||
/** @var TestCase $this */
|
||||
Carbon::setTestNow('2026-06-01 10:00:00');
|
||||
|
||||
$admin = makeAdmin();
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$category = Category::factory()->create();
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.create')
|
||||
->set('title', 'Past Date PM')
|
||||
->set('text', str_repeat('Inhalt eines Tests. ', 5))
|
||||
->set('companyId', $company->id)
|
||||
->set('categoryId', $category->id)
|
||||
->set('portal', $company->portal->value)
|
||||
->set('publishMode', 'scheduled')
|
||||
->set('scheduledAt', '2026-05-15T10:00')
|
||||
->call('save')
|
||||
->assertHasErrors(['scheduledAt']);
|
||||
});
|
||||
|
||||
test('admin edit hydriert scheduled_at und embargo_at', function () {
|
||||
/** @var TestCase $this */
|
||||
Carbon::setTestNow('2026-06-01 10:00:00');
|
||||
|
||||
$admin = makeAdmin();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$pr = PressRelease::factory()->create([
|
||||
'scheduled_at' => '2026-06-05 14:30:00',
|
||||
'embargo_at' => '2026-06-10 08:00:00',
|
||||
]);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.edit', ['id' => $pr->id])
|
||||
->assertSet('publishMode', 'scheduled')
|
||||
->assertSet('scheduledAt', '2026-06-05T14:30')
|
||||
->assertSet('useEmbargo', true)
|
||||
->assertSet('embargoAt', '2026-06-10T08:00');
|
||||
});
|
||||
|
||||
test('admin edit persistiert scheduled_at und embargo_at', function () {
|
||||
/** @var TestCase $this */
|
||||
Carbon::setTestNow('2026-06-01 10:00:00');
|
||||
|
||||
$admin = makeAdmin();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$pr = PressRelease::factory()->create([
|
||||
'scheduled_at' => null,
|
||||
'embargo_at' => null,
|
||||
]);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.edit', ['id' => $pr->id])
|
||||
->set('publishMode', 'scheduled')
|
||||
->set('scheduledAt', '2026-06-08T09:00')
|
||||
->set('useEmbargo', true)
|
||||
->set('embargoAt', '2026-06-12T12:00')
|
||||
->call('save')
|
||||
->assertHasNoErrors();
|
||||
|
||||
$pr->refresh();
|
||||
|
||||
expect($pr->scheduled_at?->toDateTimeString())->toBe('2026-06-08 09:00:00');
|
||||
expect($pr->embargo_at?->toDateTimeString())->toBe('2026-06-12 12:00:00');
|
||||
});
|
||||
|
||||
test('admin publishMode now clears scheduled_at on save', function () {
|
||||
/** @var TestCase $this */
|
||||
Carbon::setTestNow('2026-06-01 10:00:00');
|
||||
|
||||
$admin = makeAdmin();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$pr = PressRelease::factory()->create([
|
||||
'scheduled_at' => '2026-06-05 14:30:00',
|
||||
'embargo_at' => '2026-06-10 08:00:00',
|
||||
]);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.edit', ['id' => $pr->id])
|
||||
->set('publishMode', 'now')
|
||||
->set('useEmbargo', false)
|
||||
->call('save')
|
||||
->assertHasNoErrors();
|
||||
|
||||
$pr->refresh();
|
||||
|
||||
expect($pr->scheduled_at)->toBeNull();
|
||||
expect($pr->embargo_at)->toBeNull();
|
||||
});
|
||||
124
tests/Feature/Admin/AdminPressReleaseShowTest.php
Normal file
124
tests/Feature/Admin/AdminPressReleaseShowTest.php
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\Company;
|
||||
use App\Models\Contact;
|
||||
use App\Models\PressRelease;
|
||||
use App\Models\PressReleaseStatusLog;
|
||||
use App\Models\User;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Livewire\Volt\Volt as LivewireVolt;
|
||||
use Tests\TestCase;
|
||||
|
||||
beforeEach(function (): void {
|
||||
/** @var TestCase $this */
|
||||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
});
|
||||
|
||||
function makeAdminForShow(): User
|
||||
{
|
||||
$admin = User::factory()->create(['is_active' => true]);
|
||||
$admin->assignRole('admin');
|
||||
|
||||
return $admin;
|
||||
}
|
||||
|
||||
test('admin show rendert Rejection-Banner mit letzter Begründung', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeAdminForShow();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$pr = PressRelease::factory()->create([
|
||||
'status' => PressReleaseStatus::Rejected->value,
|
||||
]);
|
||||
PressReleaseStatusLog::query()->create([
|
||||
'press_release_id' => $pr->id,
|
||||
'changed_by_user_id' => $admin->id,
|
||||
'from_status' => PressReleaseStatus::Review->value,
|
||||
'to_status' => PressReleaseStatus::Rejected->value,
|
||||
'reason' => 'Werbliche Sprache, bitte überarbeiten.',
|
||||
'source' => 'admin',
|
||||
'created_at' => now(),
|
||||
]);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.show', ['id' => $pr->id])
|
||||
->assertSee('Diese Pressemitteilung wurde abgelehnt')
|
||||
->assertSee('Werbliche Sprache, bitte überarbeiten.');
|
||||
});
|
||||
|
||||
test('admin show zeigt zugeordnete Pressekontakte', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeAdminForShow();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$company = Company::factory()->presseecho()->create();
|
||||
$contact = Contact::factory()->for($company)->create([
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Mustermann',
|
||||
'responsibility' => 'Pressesprecher',
|
||||
'email' => 'presse@example.test',
|
||||
'portal' => $company->portal->value,
|
||||
]);
|
||||
|
||||
$pr = PressRelease::factory()->create(['company_id' => $company->id]);
|
||||
$pr->contacts()->sync([$contact->id]);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.show', ['id' => $pr->id])
|
||||
->assertSee('Zugeordnete Pressekontakte')
|
||||
->assertSee('Max Mustermann')
|
||||
->assertSee('Pressesprecher')
|
||||
->assertSee('presse@example.test');
|
||||
});
|
||||
|
||||
test('admin show zeigt Hinweis bei fehlenden Kontakten', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeAdminForShow();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$pr = PressRelease::factory()->create();
|
||||
|
||||
LivewireVolt::test('admin.press-releases.show', ['id' => $pr->id])
|
||||
->assertSee('Dieser Pressemitteilung ist kein Pressekontakt zugeordnet.');
|
||||
});
|
||||
|
||||
test('admin show zeigt Scheduling-Termin im Review-Workflow', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeAdminForShow();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$pr = PressRelease::factory()->create([
|
||||
'status' => PressReleaseStatus::Review->value,
|
||||
'scheduled_at' => '2026-06-15 10:00:00',
|
||||
]);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.show', ['id' => $pr->id])
|
||||
->assertSee('Geplante Veröffentlichung')
|
||||
->assertSee('15.06.2026 10:00');
|
||||
});
|
||||
|
||||
test('admin show zeigt Embargo-Info im Published-Workflow', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeAdminForShow();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$pr = PressRelease::factory()->create([
|
||||
'status' => PressReleaseStatus::Published->value,
|
||||
'published_at' => '2026-06-01 10:00:00',
|
||||
'embargo_at' => now()->addDays(10),
|
||||
]);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.show', ['id' => $pr->id])
|
||||
->assertSee('Sperrfrist bis');
|
||||
});
|
||||
|
||||
test('admin show zeigt Autor im Status-Verlauf-Grid', function () {
|
||||
/** @var TestCase $this */
|
||||
$admin = makeAdminForShow();
|
||||
$this->actingAs($admin);
|
||||
|
||||
$author = User::factory()->create(['name' => 'Anna Autorin']);
|
||||
$pr = PressRelease::factory()->create(['user_id' => $author->id]);
|
||||
|
||||
LivewireVolt::test('admin.press-releases.show', ['id' => $pr->id])
|
||||
->assertSee('Anna Autorin');
|
||||
});
|
||||
|
|
@ -7,6 +7,7 @@ use App\Models\Profile;
|
|||
use App\Models\User;
|
||||
use App\Models\UserFilterPreset;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Livewire\Volt\Volt as LivewireVolt;
|
||||
use Tests\TestCase;
|
||||
|
|
@ -555,6 +556,61 @@ test('admin can open user details modal from users index and see company link st
|
|||
->assertSet('contactLookup', '');
|
||||
});
|
||||
|
||||
test('admin users index free text search matches names and email parts', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
|
||||
$admin = User::factory()->create();
|
||||
$admin->assignRole('admin');
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Seabstian Einrock',
|
||||
'email' => 'info@connectar.de',
|
||||
])->assignRole('customer');
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Barbara Barr',
|
||||
'email' => 'barbara@example.com',
|
||||
])->assignRole('customer');
|
||||
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.users')
|
||||
->set('search', 'Seabstian')
|
||||
->assertSee('info@connectar.de')
|
||||
->assertDontSee('barbara@example.com')
|
||||
->set('search', 'Einrock')
|
||||
->assertSee('info@connectar.de')
|
||||
->assertDontSee('barbara@example.com')
|
||||
->set('search', 'connectar.de')
|
||||
->assertSee('Seabstian Einrock')
|
||||
->assertDontSee('Barbara Barr')
|
||||
->set('search', 'Seabstian Einrock info@connectar.de')
|
||||
->assertSee('info@connectar.de')
|
||||
->assertDontSee('barbara@example.com')
|
||||
->set('search', 'Barr')
|
||||
->assertSee('barbara@example.com')
|
||||
->assertDontSee('info@connectar.de');
|
||||
});
|
||||
|
||||
test('admin users index uses full count pagination', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
|
||||
$admin = User::factory()->create();
|
||||
$admin->assignRole('admin');
|
||||
|
||||
User::factory()->count(51)->create();
|
||||
|
||||
$this->actingAs($admin);
|
||||
|
||||
LivewireVolt::test('admin.users')
|
||||
->assertViewHas('users', fn ($users): bool => $users instanceof LengthAwarePaginator
|
||||
&& $users->perPage() === 50
|
||||
&& $users->total() === 52
|
||||
&& $users->lastPage() === 2);
|
||||
});
|
||||
|
||||
test('admin users index supports workflow filters and quality badges', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue