TenantAtlas/tests/Unit/DeviceConfigurationPolicyNormalizerTest.php
ahmido 93dbd3b13d fix(tests): remove per-file TestCase uses (#45)
What Changed

Removed per-file uses(TestCase::class ...) bindings in Unit tests to avoid Pest v4 “folder already uses the test case” discovery failure (kept RefreshDatabase where needed).
Updated the backup scheduling job test to pass the newly required BulkOperationService when manually calling RunBackupScheduleJob::handle().
Where

Unit (bulk cleanup across 56 files)
RunBackupScheduleJobTest.php
Verification

./vendor/bin/sail test → 443 passed, 5 skipped

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local>
Reviewed-on: #45
2026-01-08 00:41:46 +00:00

38 lines
1.3 KiB
PHP

<?php
use App\Services\Intune\DeviceConfigurationPolicyNormalizer;
it('builds a configuration block for device configuration policies', function () {
$normalizer = app(DeviceConfigurationPolicyNormalizer::class);
$snapshot = [
'@odata.type' => '#microsoft.graph.windows10CustomConfiguration',
'displayName' => 'Device Config Policy',
'description' => 'Test policy',
'omaSettings' => [
[
'displayName' => 'Setting A',
'omaUri' => './Vendor/MSFT/SettingA',
'value' => 'Enabled',
],
],
'customSetting' => 'Custom value',
'nestedSetting' => ['value' => 'Nested'],
];
$normalized = $normalizer->normalize($snapshot, 'deviceConfiguration', 'windows');
$settings = collect($normalized['settings']);
$omaBlock = $settings->firstWhere('title', 'OMA-URI settings');
expect($omaBlock)->not->toBeNull();
$configurationBlock = $settings->firstWhere('title', 'Configuration');
expect($configurationBlock)->not->toBeNull();
$labels = collect($configurationBlock['entries'])->pluck('key')->all();
expect($labels)->toContain('Custom Setting', 'Nested Setting');
expect($labels)->not->toContain('Display Name');
expect($settings->pluck('title')->all())->not->toContain('General');
});