TenantAtlas/apps/platform/tests/Feature/Guards/SharedDetailFamilyContractGuardTest.php
ahmido c0f4587d90 Spec 197: standardize shared detail family contracts (#237)
## Summary
- standardize the shared verification report family across operation detail, onboarding, and tenant verification widget hosts
- standardize normalized settings and normalized diff family wrappers across policy, policy version, and finding detail hosts
- add parity and guard coverage plus the full Spec 197 artifacts, including recorded manual smoke evidence

## Testing
- focused Sail regression pack from `specs/197-shared-detail-contract/quickstart.md`
- local integrated-browser manual smoke for SC-197-003 and SC-197-004

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #237
2026-04-15 09:51:42 +00:00

38 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
use Illuminate\Support\Facades\File;
it('keeps verification tab ownership inside the shared viewer', function (): void {
$sharedViewer = (string) file_get_contents(resource_path('views/filament/components/verification-report-viewer.blade.php'));
expect($sharedViewer)
->toContain('data-shared-detail-family="verification-report"')
->toContain('Verification report tabs');
$hostViews = [
resource_path('views/filament/forms/components/managed-tenant-onboarding-verification-report.blade.php'),
resource_path('views/filament/widgets/tenant/tenant-verification-report.blade.php'),
];
foreach ($hostViews as $path) {
expect((string) file_get_contents($path))->not->toContain('Verification report tabs');
}
});
it('keeps policy-settings-standard as a compatibility wrapper only', function (): void {
$compatibilityView = (string) file_get_contents(resource_path('views/filament/infolists/entries/policy-settings-standard.blade.php'));
expect($compatibilityView)->toContain('normalized-settings.wrapper');
$directUsages = collect(File::allFiles(resource_path('views/filament')))
->reject(static fn (\SplFileInfo $file): bool => $file->getPathname() === resource_path('views/filament/infolists/entries/policy-settings-standard.blade.php'))
->filter(static fn (\SplFileInfo $file): bool => str_contains((string) file_get_contents($file->getPathname()), 'policy-settings-standard'))
->map(static fn (\SplFileInfo $file): string => str_replace(resource_path('views/'), '', $file->getPathname()))
->values()
->all();
expect($directUsages)->toBe([]);
});