TenantAtlas/apps/platform/tests/Unit/Support/TenantConfiguration/Spec420M365CaptureClaimGuardTest.php
ahmido a73a8f5882 feat: complete m365 generic evidence coverage pack (#487)
Committing and publishing the current Spec 420 package changes.

Includes updated services, coverage tests, browser smoke coverage, and the spec/plan/tasks artifacts for the package.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #487
2026-06-27 12:24:00 +00:00

43 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
use App\Services\TenantConfiguration\ClaimGuard;
use App\Support\TenantConfiguration\ClaimState;
use App\Support\TenantConfiguration\CoverageLevel;
use App\Support\TenantConfiguration\IdentityState;
use App\Support\TenantConfiguration\RestoreTier;
use App\Support\TenantConfiguration\SourceClass;
it('Spec420 blocks broad Microsoft 365 customer-facing claims', function (string $claim): void {
expect(app(ClaimGuard::class)->evaluateStatement($claim))->toBe(ClaimState::ClaimBlocked);
})->with([
'M365 coverage is certified',
'Microsoft 365 restore-ready coverage',
'Complete tenant coverage',
'All M365 resources are supported',
'100 percent coverage',
]);
it('Spec420 blocks unsafe Conditional Access customer claims when identity is not stable', function (IdentityState $identityState): void {
$state = app(ClaimGuard::class)->evaluate(
scopeKey: 'm365_tcm_registry_detected',
requestedLevel: CoverageLevel::ContentBacked,
actualLevel: CoverageLevel::ContentBacked,
scopeComplete: false,
customerFacing: true,
customerClaimsAllowed: false,
sourceClass: SourceClass::Tcm,
restoreTier: RestoreTier::NotRestorable,
identityState: $identityState,
allowsDerivedIdentityClaims: false,
);
expect($state)->toBe(ClaimState::ClaimBlocked);
})->with([
'missing external id' => [IdentityState::MissingExternalId],
'unsupported identity' => [IdentityState::UnsupportedIdentity],
'identity conflict' => [IdentityState::IdentityConflict],
'derived identity' => [IdentityState::Derived],
]);