## Summary <!-- Kurz: Was ändert sich und warum? --> ## Spec-Driven Development (SDD) - [ ] Es gibt eine Spec unter `specs/<NNN>-<feature>/` - [ ] Enthaltene Dateien: `plan.md`, `tasks.md`, `spec.md` - [ ] Spec beschreibt Verhalten/Acceptance Criteria (nicht nur Implementation) - [ ] Wenn sich Anforderungen während der Umsetzung geändert haben: Spec/Plan/Tasks wurden aktualisiert ## Implementation - [ ] Implementierung entspricht der Spec - [ ] Edge cases / Fehlerfälle berücksichtigt - [ ] Keine unbeabsichtigten Änderungen außerhalb des Scopes ## Tests - [ ] Tests ergänzt/aktualisiert (Pest/PHPUnit) - [ ] Relevante Tests lokal ausgeführt (`./vendor/bin/sail artisan test` oder `php artisan test`) ## Migration / Config / Ops (falls relevant) - [ ] Migration(en) enthalten und getestet - [ ] Rollback bedacht (rückwärts kompatibel, sichere Migration) - [ ] Neue Env Vars dokumentiert (`.env.example` / Doku) - [ ] Queue/cron/storage Auswirkungen geprüft ## UI (Filament/Livewire) (falls relevant) - [ ] UI-Flows geprüft - [ ] Screenshots/Notizen hinzugefügt ## Notes <!-- Links, Screenshots, Follow-ups, offene Punkte --> Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local> Reviewed-on: #3
53 lines
2.1 KiB
PHP
53 lines
2.1 KiB
PHP
<?php
|
|
|
|
use App\Services\Intune\PolicyNormalizer;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
uses(TestCase::class);
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
$this->normalizer = app(PolicyNormalizer::class);
|
|
});
|
|
|
|
it('normalizes settings catalog settings into key value entries', function () {
|
|
$snapshot = [
|
|
'@odata.type' => '#microsoft.graph.deviceManagementConfigurationPolicy',
|
|
'settings' => [
|
|
[
|
|
'settingInstance' => [
|
|
'@odata.type' => '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance',
|
|
'settingDefinitionId' => 'device_vendor_msft_policy_config_system_minimumpinlength',
|
|
'simpleSettingValue' => [
|
|
'value' => 12,
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'settingInstance' => [
|
|
'@odata.type' => '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance',
|
|
'settingDefinitionId' => 'device_vendor_msft_policy_config_winhello_usebiometrics',
|
|
'choiceSettingValue' => [
|
|
'value' => 'device_vendor_msft_policy_config_winhello_usebiometrics_true',
|
|
],
|
|
],
|
|
],
|
|
],
|
|
];
|
|
|
|
$result = $this->normalizer->normalize($snapshot, 'settingsCatalogPolicy', 'windows');
|
|
|
|
expect($result['status'])->toBe('success');
|
|
expect($result)->toHaveKey('settings_table');
|
|
$rows = $result['settings_table']['rows'];
|
|
expect($rows[0]['definition'])->toContain('Minimum'); // Prettified display name
|
|
expect($rows[0]['data_type'])->toBe('Number'); // User-friendly type
|
|
expect($rows[0]['value'])->toBe('12');
|
|
expect($rows[0])->toHaveKey('category');
|
|
expect($rows[0])->toHaveKey('description');
|
|
expect($rows[1]['definition'])->toContain('Winhello'); // Prettified display name
|
|
expect($rows[1]['data_type'])->toBe('Choice'); // User-friendly type
|
|
expect($rows[1]['value'])->toBe('Enabled'); // Formatted from choice value
|
|
});
|