create([ 'status' => 'active', ]); $policy = Policy::factory()->create([ 'tenant_id' => $tenant->id, 'external_id' => 'policy-1', 'policy_type' => 'appProtectionPolicy', 'ignored_at' => null, ]); $logger = mock(GraphLogger::class); $logger->shouldReceive('logRequest') ->zeroOrMoreTimes() ->andReturnNull(); $logger->shouldReceive('logResponse') ->zeroOrMoreTimes() ->andReturnNull(); mock(GraphClientInterface::class) ->shouldReceive('listPolicies') ->once() ->andReturn(new GraphResponse( success: true, data: [ [ 'id' => 'policy-1', 'displayName' => 'Ignored policy', '@odata.type' => '#microsoft.graph.targetedManagedAppConfiguration', ], ], )); $service = app(PolicySyncService::class); $synced = $service->syncPolicies($tenant, [ ['type' => 'appProtectionPolicy'], ]); $policy->refresh(); expect($policy->ignored_at)->not->toBeNull(); expect($synced)->toBeArray()->toBeEmpty(); }); it('uses isof filters for windows update rings and supports feature/quality update profiles', function () { $supported = config('tenantpilot.supported_policy_types'); $byType = collect($supported)->keyBy('type'); expect($byType)->toHaveKeys(['deviceConfiguration', 'windowsUpdateRing', 'windowsFeatureUpdateProfile', 'windowsQualityUpdateProfile']); expect($byType['deviceConfiguration']['filter'] ?? null) ->toBe("not isof('microsoft.graph.windowsUpdateForBusinessConfiguration')"); expect($byType['windowsUpdateRing']['filter'] ?? null) ->toBe("isof('microsoft.graph.windowsUpdateForBusinessConfiguration')"); expect($byType['windowsFeatureUpdateProfile']['endpoint'] ?? null) ->toBe('deviceManagement/windowsFeatureUpdateProfiles'); expect($byType['windowsQualityUpdateProfile']['endpoint'] ?? null) ->toBe('deviceManagement/windowsQualityUpdateProfiles'); });