findActive('intune_tcm_core'); expect($scope)->not->toBeNull() ->and($scope?->minimum_coverage_level)->toBe(CoverageLevel::ContentBacked) ->and($scope?->included_resource_types)->toBe([ 'deviceAndAppManagementAssignmentFilter', 'deviceEnrollmentLimitRestriction', 'deviceEnrollmentPlatformRestriction', 'deviceEnrollmentStatusPageWindows10', 'appProtectionPolicyAndroid', 'appProtectionPolicyiOS', ]) ->and($scope?->allow_beta)->toBeFalse() ->and($scope?->allow_graph_fallback)->toBeFalse(); }); it('Spec414 resolves persisted scopes against persisted active resource types', function () { $resolver = new SupportedScopeResolver; $scope = $resolver->findActive('intune_tcm_core_with_graph_fallback'); $resourceTypes = (new ResourceTypeRegistry)->active(); expect($scope)->not->toBeNull(); $resolved = $resolver->resolveDefinition($scope, $resourceTypes); expect($resolved['included_resource_types'])->toContain('notificationMessageTemplate') ->and($resolved['included_resource_types'])->not->toContain('roleScopeTag') ->and($resolved['allow_graph_fallback'])->toBeTrue(); }); it('Spec414 fails closed for persisted supported scopes with unknown denominator entries', function () { $scope = TenantConfigurationSupportedScope::factory()->create([ 'scope_key' => 'invalid_persisted_scope', 'minimum_coverage_level' => CoverageLevel::ContentBacked->value, 'included_resource_types' => [ 'deviceAndAppManagementAssignmentFilter', 'unknownResourceType', ], 'customer_claims_allowed' => true, ]); expect(fn () => (new SupportedScopeResolver)->resolveDefinition($scope, (new ResourceTypeRegistry)->active())) ->toThrow(UnexpectedValueException::class, 'unknownResourceType'); }); it('Spec414 keeps default supported-scope setup upsert-safe', function () { $resolver = new SupportedScopeResolver; $resolver->syncDefaults(); $resolver->syncDefaults(); expect(TenantConfigurationSupportedScope::query()->count())->toBe(2) ->and(TenantConfigurationSupportedScope::query() ->where('scope_key', 'intune_tcm_core') ->count())->toBe(1); });