TenantAtlas/apps/platform/tests/Feature/Filament/BackupSetGraphSafetyTest.php
Ahmed Darrazi 1123b122d9
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 7m13s
feat: cut over tenant core to managed environments
2026-05-07 08:35:42 +02:00

41 lines
1.3 KiB
PHP

<?php
use App\Filament\Resources\BackupSetResource;
use App\Models\BackupSet;
use App\Models\ManagedEnvironment;
test('backup sets index renders without touching graph', function () {
$tenant = ManagedEnvironment::factory()->create();
$otherTenant = ManagedEnvironment::factory()->create();
[$user] = createUserWithTenant($tenant);
$user->tenants()->syncWithoutDetaching([
$otherTenant->getKey() => ['role' => 'owner'],
]);
$visibleSet = BackupSet::factory()->create([
'managed_environment_id' => $tenant->getKey(),
'name' => 'visible-backup-set',
]);
$hiddenSet = BackupSet::factory()->create([
'managed_environment_id' => $otherTenant->getKey(),
'name' => 'hidden-backup-set',
]);
bindFailHardGraphClient();
$response = $this->actingAs($user)
->get(BackupSetResource::getUrl('index', tenant: $tenant))
->assertOk()
->assertSee('Created by');
$content = (string) $response->getContent();
preg_match('/<tbody[^>]*>(.*?)<\\/tbody>/is', $content, $tbodyMatch);
$tableCellText = html_entity_decode(strip_tags((string) ($tbodyMatch[1] ?? '')));
expect($tableCellText)
->toContain($visibleSet->name)
->not->toContain($hiddenSet->name);
});