TenantAtlas/apps/platform/tests/Feature/Artifacts/StoredReportSourceTaxonomyTest.php
ahmido 75ebade345 feat: implement provider-neutral artifact source taxonomy (#343)
## Summary

Implements Spec 284 for provider-neutral artifact source taxonomy.

- add shared artifact source descriptor, resolver, taxonomy, and provider-detail support
- update findings, evidence snapshots, stored reports, inventory items, and tenant review surfaces to disclose descriptor-first artifact summaries
- add bounded Pest unit, feature, guard, and browser coverage for the taxonomy slice
- include the completed Spec 284 package artifacts under `specs/284-provider-neutral-artifact-source-taxonomy/`

## Notes

- branch: `284-provider-neutral-artifact-source-taxonomy`
- commit: `bf8d59e0`
- this PR was created as part of the requested commit/push/PR flow against `platform-dev`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #343
2026-05-08 23:47:31 +00:00

42 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\StoredReport;
it('derives stored report descriptor and keeps report_type as provider detail', function (): void {
[$user, $tenant] = createUserWithTenant(ensureDefaultMicrosoftProviderConnection: true);
$connection = $tenant->providerConnections()->where('provider', 'microsoft')->where('is_default', true)->firstOrFail();
$report = StoredReport::factory()->entraAdminRoles([
'provider_key' => 'microsoft',
'provider_connection_id' => (int) $connection->getKey(),
])->create([
'managed_environment_id' => (int) $tenant->getKey(),
'workspace_id' => (int) $tenant->workspace_id,
]);
$descriptor = $report->artifactSourceDescriptor()->toArray();
expect($descriptor)->toMatchArray([
'workspace_id' => (int) $tenant->workspace_id,
'tenant_id' => (int) $tenant->getKey(),
'managed_environment_id' => (int) $tenant->getKey(),
'source_family' => 'stored_report',
'source_kind' => 'stored_report',
'provider_key' => 'microsoft',
'provider_connection_id' => (int) $connection->getKey(),
'source_target_kind' => 'managed_environment',
'detector_key' => 'entra_admin_roles.privileged_role_assignment',
'control_key' => 'privileged_access_governance',
'package_run_id' => null,
])
->and($descriptor)->not->toHaveKey('report_type')
->and($report->artifactProviderDetail()->toArray())->toMatchArray([
'legacy_report_type' => StoredReport::REPORT_TYPE_ENTRA_ADMIN_ROLES,
'provider_object_type' => StoredReport::REPORT_TYPE_ENTRA_ADMIN_ROLES,
]);
$this->actingAs($user);
});