## Summary - Capture and restore foundation types (assignment filters, scope tags, notification templates) with deterministic mapping. - Apply foundation mappings during restore (scope tags on policy payloads, assignment filter mapping with skip reasons). - Improve restore run UX (item selection, rerun action, preview-only badges). - Enforce preview-only policy types (e.g. Conditional Access) during execution. ## Testing - ./vendor/bin/sail artisan test tests/Feature/Filament/ConditionalAccessPreviewOnlyTest.php ## Notes - Specs/plan/tasks updated under specs/006-sot-foundations-assignments. - No migrations. Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local> Reviewed-on: #7
76 lines
2.2 KiB
PHP
76 lines
2.2 KiB
PHP
<?php
|
|
|
|
use App\Filament\Resources\RestoreRunResource\Pages\CreateRestoreRun;
|
|
use App\Models\BackupItem;
|
|
use App\Models\BackupSet;
|
|
use App\Models\Policy;
|
|
use App\Models\Tenant;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
test('restore selection shows readable labels and descriptions', function () {
|
|
$tenant = Tenant::factory()->create(['status' => 'active']);
|
|
$tenant->makeCurrent();
|
|
|
|
$policy = Policy::factory()->create([
|
|
'tenant_id' => $tenant->id,
|
|
'external_id' => 'policy-1',
|
|
'policy_type' => 'settingsCatalogPolicy',
|
|
'display_name' => 'Policy Display',
|
|
'platform' => 'windows',
|
|
]);
|
|
|
|
$backupSet = BackupSet::factory()->for($tenant)->create([
|
|
'item_count' => 2,
|
|
]);
|
|
|
|
BackupItem::factory()
|
|
->for($tenant)
|
|
->for($backupSet)
|
|
->state([
|
|
'policy_id' => $policy->id,
|
|
'policy_identifier' => $policy->external_id,
|
|
'policy_type' => $policy->policy_type,
|
|
'platform' => $policy->platform,
|
|
'payload' => ['id' => $policy->external_id],
|
|
])
|
|
->create();
|
|
|
|
BackupItem::factory()
|
|
->for($tenant)
|
|
->for($backupSet)
|
|
->state([
|
|
'policy_id' => null,
|
|
'policy_identifier' => 'tag-1',
|
|
'policy_type' => 'roleScopeTag',
|
|
'platform' => 'all',
|
|
'payload' => [
|
|
'id' => 'tag-1',
|
|
'displayName' => 'Scope Tag Alpha',
|
|
],
|
|
'metadata' => [
|
|
'displayName' => 'Scope Tag Alpha',
|
|
],
|
|
])
|
|
->create();
|
|
|
|
$user = User::factory()->create();
|
|
$this->actingAs($user);
|
|
|
|
Livewire::test(CreateRestoreRun::class)
|
|
->fillForm([
|
|
'backup_set_id' => $backupSet->id,
|
|
])
|
|
->assertSee('Policy Display')
|
|
->assertSee('Scope Tag Alpha')
|
|
->assertSee('Settings Catalog Policy')
|
|
->assertSee('Scope Tag')
|
|
->assertSee('restore: enabled')
|
|
->assertSee('id: policy-1')
|
|
->assertSee('id: tag-1')
|
|
->assertSee('Include foundations');
|
|
});
|