Pest v4 discovery fails when unit tests re-bind the test case with uses(TestCase::class). Remove per-file bindings and keep RefreshDatabase where needed. Also update RunBackupScheduleJobTest to pass BulkOperationService when calling handle() manually.
51 lines
2.0 KiB
PHP
51 lines
2.0 KiB
PHP
<?php
|
|
|
|
use App\Services\Intune\PolicyNormalizer;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
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
|
|
});
|