- 83 Komponenten: Livewire\Volt\Component → Livewire\Component
- 73 Routen (admin, auth, customer): Volt::route() → Route::livewire()
- 88 Testdateien: Volt::test/actingAs → Livewire::test/actingAs
- VoltServiceProvider gelöscht; composer remove livewire/volt
- config/livewire.php auf v4-Schlüssel (component_layout, component_placeholder,
component_locations, make_command: SFC ohne ⚡). Der alte Schlüssel layout war
wirkungslos; alle gerouteten Komponenten setzen ihr Layout selbst.
- CLAUDE.md, AGENTS.md, boost.json, .cursorrules, Skill volt-development
- Roadmap: erledigt; Larastan erfasst SFCs weiterhin nicht (Blade-Dateien)
Suite 2.325 grün, einer übersprungen; Larastan und Pint ohne Meldung;
route:cache und view:cache laufen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
101 lines
3.2 KiB
PHP
101 lines
3.2 KiB
PHP
<?php
|
|
|
|
use App\Enums\ContactMessageStatus;
|
|
use App\Enums\ContactMessageTopic;
|
|
use App\Models\ContactMessage;
|
|
use App\Models\User;
|
|
use Database\Seeders\RolesAndPermissionsSeeder;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
beforeEach(function () {
|
|
/** @var TestCase $this */
|
|
$this->seed(RolesAndPermissionsSeeder::class);
|
|
});
|
|
|
|
function contactMessagesAdmin(): User
|
|
{
|
|
$admin = User::factory()->create(['is_active' => true]);
|
|
$admin->assignRole('admin');
|
|
|
|
return $admin;
|
|
}
|
|
|
|
test('the contact queue lists open contact messages', function () {
|
|
$message = ContactMessage::factory()
|
|
->topic(ContactMessageTopic::BugReport)
|
|
->create([
|
|
'name' => 'Bernd Bug',
|
|
'email' => 'bernd@example.test',
|
|
]);
|
|
|
|
Livewire::actingAs(contactMessagesAdmin())
|
|
->test('admin.contact-messages.index')
|
|
->assertOk()
|
|
->assertSee('KT-'.$message->id)
|
|
->assertSee('Fehlermeldung')
|
|
->assertSee('Bernd Bug')
|
|
->assertSee('bernd@example.test');
|
|
});
|
|
|
|
test('resolved contact messages are hidden from the default open view', function () {
|
|
ContactMessage::factory()->resolved()->create(['name' => 'Erledigte Person']);
|
|
|
|
Livewire::actingAs(contactMessagesAdmin())
|
|
->test('admin.contact-messages.index')
|
|
->assertOk()
|
|
->assertDontSee('Erledigte Person');
|
|
});
|
|
|
|
test('the contact queue can be filtered by topic', function () {
|
|
ContactMessage::factory()->topic(ContactMessageTopic::Feedback)->create(['name' => 'Frieda Feedback']);
|
|
ContactMessage::factory()->topic(ContactMessageTopic::BugReport)->create(['name' => 'Bernd Bug']);
|
|
|
|
Livewire::actingAs(contactMessagesAdmin())
|
|
->test('admin.contact-messages.index')
|
|
->set('topicFilter', 'feedback')
|
|
->assertSee('Frieda Feedback')
|
|
->assertDontSee('Bernd Bug');
|
|
});
|
|
|
|
test('an admin can resolve a contact message with a note', function () {
|
|
$admin = contactMessagesAdmin();
|
|
$message = ContactMessage::factory()->create();
|
|
|
|
Livewire::actingAs($admin)
|
|
->test('admin.contact-messages.show', ['id' => $message->id])
|
|
->set('adminNote', 'Per E-Mail beantwortet.')
|
|
->call('resolve')
|
|
->assertOk();
|
|
|
|
$message->refresh();
|
|
|
|
expect($message->status)->toBe(ContactMessageStatus::Resolved)
|
|
->and($message->admin_note)->toBe('Per E-Mail beantwortet.')
|
|
->and($message->resolved_by_user_id)->toBe($admin->id)
|
|
->and($message->resolved_at)->not->toBeNull();
|
|
});
|
|
|
|
test('an admin can reopen a resolved contact message', function () {
|
|
$message = ContactMessage::factory()->resolved()->create();
|
|
|
|
Livewire::actingAs(contactMessagesAdmin())
|
|
->test('admin.contact-messages.show', ['id' => $message->id])
|
|
->call('reopen')
|
|
->assertOk();
|
|
|
|
$message->refresh();
|
|
|
|
expect($message->status)->toBe(ContactMessageStatus::Open)
|
|
->and($message->resolved_at)->toBeNull();
|
|
});
|
|
|
|
test('customers cannot access the contact queue', function () {
|
|
/** @var TestCase $this */
|
|
$customer = User::factory()->create(['is_active' => true, 'email_verified_at' => now()]);
|
|
$customer->assignRole('customer');
|
|
|
|
$this->actingAs($customer)
|
|
->get('https://pressekonto.test/admin/contact-messages')
|
|
->assertForbidden();
|
|
});
|