Admin: Widerrufe laufen in der Recht-&-Compliance-Queue auf
Eigene Widerrufe-Sektion unter der Anfragen-Tabelle in /admin/legal-requests: Vorgangsnummer, Zuordnungsdaten, Statusfilter (offen/alle/erledigt, eigener Paginator), Erledigt/Wieder-oeffnen-Aktion mit resolved_at; KPI-Karte "Offene Widerrufe". Dazu WithdrawalRequest-Factory (+resolved-State) fuer die Tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
8001280185
commit
d6461f5c5e
4 changed files with 259 additions and 2 deletions
75
tests/Feature/Admin/WithdrawalRequestsAdminTest.php
Normal file
75
tests/Feature/Admin/WithdrawalRequestsAdminTest.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\WithdrawalRequest;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Livewire\Volt\Volt;
|
||||
use Tests\TestCase;
|
||||
|
||||
beforeEach(function () {
|
||||
/** @var TestCase $this */
|
||||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
});
|
||||
|
||||
function withdrawalAdmin(): User
|
||||
{
|
||||
$admin = User::factory()->create(['is_active' => true]);
|
||||
$admin->assignRole('admin');
|
||||
|
||||
return $admin;
|
||||
}
|
||||
|
||||
test('the legal queue lists open withdrawal requests', function () {
|
||||
$withdrawal = WithdrawalRequest::factory()->create([
|
||||
'name' => 'Paula Presse',
|
||||
'email' => 'paula@example.test',
|
||||
'order_reference' => 'STR-2026-0042',
|
||||
]);
|
||||
|
||||
Volt::actingAs(withdrawalAdmin())
|
||||
->test('admin.legal-requests.index')
|
||||
->assertOk()
|
||||
->assertSee('Widerrufe')
|
||||
->assertSee('W-'.$withdrawal->id)
|
||||
->assertSee('Paula Presse')
|
||||
->assertSee('paula@example.test')
|
||||
->assertSee('STR-2026-0042');
|
||||
});
|
||||
|
||||
test('an admin can resolve a withdrawal request', function () {
|
||||
$withdrawal = WithdrawalRequest::factory()->create();
|
||||
|
||||
Volt::actingAs(withdrawalAdmin())
|
||||
->test('admin.legal-requests.index')
|
||||
->call('resolveWithdrawal', $withdrawal->id)
|
||||
->assertOk();
|
||||
|
||||
$withdrawal->refresh();
|
||||
|
||||
expect($withdrawal->status)->toBe('resolved');
|
||||
expect($withdrawal->resolved_at)->not->toBeNull();
|
||||
});
|
||||
|
||||
test('an admin can reopen a resolved withdrawal request', function () {
|
||||
$withdrawal = WithdrawalRequest::factory()->resolved()->create();
|
||||
|
||||
Volt::actingAs(withdrawalAdmin())
|
||||
->test('admin.legal-requests.index')
|
||||
->set('withdrawalStatusFilter', 'all')
|
||||
->call('reopenWithdrawal', $withdrawal->id)
|
||||
->assertOk();
|
||||
|
||||
$withdrawal->refresh();
|
||||
|
||||
expect($withdrawal->status)->toBe('open');
|
||||
expect($withdrawal->resolved_at)->toBeNull();
|
||||
});
|
||||
|
||||
test('resolved withdrawals are hidden from the default open view', function () {
|
||||
WithdrawalRequest::factory()->resolved()->create(['name' => 'Erledigte Person']);
|
||||
|
||||
Volt::actingAs(withdrawalAdmin())
|
||||
->test('admin.legal-requests.index')
|
||||
->assertOk()
|
||||
->assertDontSee('Erledigte Person');
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue