TenantAtlas/apps/platform/tests/Unit/Support/TenantConfiguration/EntraCertifiedPackClaimGuardTest.php
ahmido 33e496c182 feat: complete spec 425 enta certified compare pack (#492)
Implements spec 425 with Entra certified compare pack support, coverage, guards, evaluator, fixtures, and tests.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #492
2026-07-01 23:27:16 +00:00

61 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
use App\Services\TenantConfiguration\ClaimGuard;
use App\Services\TenantConfiguration\EntraCertifiedComparePackEvaluator;
use App\Support\TenantConfiguration\ClaimState;
it('Spec425 allows exact denominator-visible certified pack wording only after the evaluator passes', function (): void {
$guard = app(ClaimGuard::class);
expect($guard->evaluateCertifiedComparePackStatement(
claim: EntraCertifiedComparePackEvaluator::CLAIM_LABEL,
packPassed: true,
internalOperatorOnly: true,
))->toBe(ClaimState::InternalOnly)
->and($guard->evaluateCertifiedComparePackStatement(
claim: EntraCertifiedComparePackEvaluator::CLAIM_LABEL,
packPassed: false,
internalOperatorOnly: true,
))->toBe(ClaimState::ClaimBlocked)
->and($guard->evaluateCertifiedComparePackStatement(
claim: EntraCertifiedComparePackEvaluator::CLAIM_LABEL,
packPassed: true,
internalOperatorOnly: false,
))->toBe(ClaimState::ClaimBlocked);
});
it('Spec425 blocks certified pack wording when the denominator is omitted', function (): void {
expect(app(ClaimGuard::class)->evaluateCertifiedComparePackStatement(
claim: 'Certified Entra Core Compare Pack',
packPassed: true,
internalOperatorOnly: true,
))->toBe(ClaimState::ClaimBlocked);
});
it('Spec425 blocks broad restore customer Microsoft 365 and legal certification overclaims', function (string $claim): void {
expect(app(ClaimGuard::class)->evaluateCertifiedComparePackStatement(
claim: $claim,
packPassed: true,
internalOperatorOnly: true,
))->toBe(ClaimState::ClaimBlocked);
})->with([
'Certified Entra coverage',
'100% Entra coverage',
'Full Entra coverage',
'Entra restore-ready',
'Certified Microsoft 365 coverage',
'Customer-ready Entra proof',
'Full tenant security proof',
'Legal attestation for Entra coverage',
'Review Pack proof for Entra',
]);
it('Spec425 keeps existing generic certification claims conservative by default', function (): void {
expect(app(ClaimGuard::class)->evaluateStatement(
EntraCertifiedComparePackEvaluator::CLAIM_LABEL,
internalOperatorOnly: true,
))->toBe(ClaimState::ClaimBlocked);
});