- Add bulk restore + archived-only force delete actions - Add jobs + tests for bulk restore/force delete - Treat restore_run status 'partial' as deletable for hygiene - Update feature tasks checklist
38 lines
1009 B
PHP
38 lines
1009 B
PHP
<?php
|
|
|
|
use App\Filament\Resources\RestoreRunResource\Pages\ListRestoreRuns;
|
|
use App\Models\BackupSet;
|
|
use App\Models\RestoreRun;
|
|
use App\Models\Tenant;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
test('restore run archive action does not archive non-deletable runs', function () {
|
|
$tenant = Tenant::factory()->create();
|
|
|
|
$backupSet = BackupSet::create([
|
|
'tenant_id' => $tenant->id,
|
|
'name' => 'Set RR',
|
|
'status' => 'completed',
|
|
'item_count' => 0,
|
|
]);
|
|
|
|
$running = RestoreRun::create([
|
|
'tenant_id' => $tenant->id,
|
|
'backup_set_id' => $backupSet->id,
|
|
'status' => 'running',
|
|
'is_dry_run' => true,
|
|
]);
|
|
|
|
$user = User::factory()->create();
|
|
|
|
Livewire::actingAs($user)
|
|
->test(ListRestoreRuns::class)
|
|
->callTableAction('archive', $running);
|
|
|
|
expect(RestoreRun::withTrashed()->find($running->id)?->trashed())->toBeFalse();
|
|
});
|