TenantAtlas/tests/Unit/WindowsDriverUpdateProfileNormalizerTest.php
ahmido 69d98e925c feat/018-driver-updates-wufb (#27)
Tenants: Tenant anlegen/öffnen → tenant_id, app_client_id, app_client_secret setzen → Make current (wichtig).
Inventory → Policies: oben Sync from Intune.
In der Tabelle nach Type = “Driver Updates (Windows)” (windowsDriverUpdateProfile) filtern und Policy öffnen.
Auf der Policy: Settings-Tab prüfen (Block „Driver Update Profile“), dann Capture snapshot klicken und unter Versions die Version ansehen.
Restore-Test (nur im Test-Tenant!): Version öffnen → Restore to Intune erst als Dry-run, dann Execute; danach unter Backups & Restore → Restore Runs Ergebnis prüfen (soll graph_path mit deviceManagement/windowsDriverUpdateProfiles/... zeigen).

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local>
Reviewed-on: #27
2026-01-04 00:38:54 +00:00

39 lines
1.3 KiB
PHP

<?php
use App\Services\Intune\PolicyNormalizer;
use Tests\TestCase;
uses(TestCase::class);
it('normalizes windows driver update profiles into readable settings', function () {
$normalizer = app(PolicyNormalizer::class);
$snapshot = [
'@odata.type' => '#microsoft.graph.windowsDriverUpdateProfile',
'displayName' => 'Driver Updates A',
'description' => 'Drivers rollout policy',
'approvalType' => 'automatic',
'deploymentDeferralInDays' => 7,
'deviceReporting' => 12,
'newUpdates' => 3,
'inventorySyncStatus' => [
'driverInventorySyncState' => 'success',
'lastSuccessfulSyncDateTime' => '2026-01-01T00:00:00Z',
],
];
$result = $normalizer->normalize($snapshot, 'windowsDriverUpdateProfile', 'windows');
expect($result['status'])->toBe('success');
expect($result['settings'])->toBeArray()->not->toBeEmpty();
$driverBlock = collect($result['settings'])
->first(fn (array $block) => ($block['title'] ?? null) === 'Driver Update Profile');
expect($driverBlock)->not->toBeNull();
$keys = collect($driverBlock['entries'] ?? [])->pluck('key')->all();
expect($keys)->toContain('Approval type', 'Deployment deferral (days)', 'Devices reporting', 'New driver updates');
});