37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
use App\Services\Intune\CompliancePolicyNormalizer;
|
|
|
|
uses(Tests\TestCase::class);
|
|
|
|
it('groups compliance policy fields into structured blocks', function () {
|
|
$normalizer = app(CompliancePolicyNormalizer::class);
|
|
|
|
$snapshot = [
|
|
'@odata.type' => '#microsoft.graph.windows10CompliancePolicy',
|
|
'passwordRequired' => true,
|
|
'passwordMinimumLength' => 8,
|
|
'defenderEnabled' => true,
|
|
'bitLockerEnabled' => false,
|
|
'osMinimumVersion' => '10.0.19045',
|
|
'activeFirewallRequired' => true,
|
|
'customSetting' => 'Custom value',
|
|
];
|
|
|
|
$normalized = $normalizer->normalize($snapshot, 'deviceCompliancePolicy', 'windows');
|
|
|
|
$settings = collect($normalized['settings']);
|
|
|
|
$passwordBlock = $settings->firstWhere('title', 'Password & Access');
|
|
expect($passwordBlock)->not->toBeNull();
|
|
expect(collect($passwordBlock['rows'])->pluck('label')->all())
|
|
->toContain('Password required', 'Password minimum length');
|
|
|
|
$additionalBlock = $settings->firstWhere('title', 'Additional Settings');
|
|
expect($additionalBlock)->not->toBeNull();
|
|
expect(collect($additionalBlock['rows'])->pluck('label')->all())
|
|
->toContain('Custom Setting');
|
|
|
|
expect($settings->pluck('title')->all())->not->toContain('General');
|
|
});
|