62 lines
2.0 KiB
PHP
62 lines
2.0 KiB
PHP
<?php
|
|
|
|
use App\Models\Policy;
|
|
use App\Models\PolicyVersion;
|
|
use App\Models\Tenant;
|
|
use Carbon\CarbonImmutable;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
test('reclassify command moves ESP versions out of enrollmentRestriction', function () {
|
|
$tenant = Tenant::create([
|
|
'tenant_id' => 'tenant-reclassify',
|
|
'name' => 'Tenant Reclassify',
|
|
'metadata' => [],
|
|
'is_current' => true,
|
|
]);
|
|
|
|
$tenant->makeCurrent();
|
|
|
|
$policy = Policy::create([
|
|
'tenant_id' => $tenant->id,
|
|
'external_id' => 'esp-1',
|
|
'policy_type' => 'enrollmentRestriction',
|
|
'display_name' => 'ESP Misclassified',
|
|
'platform' => 'all',
|
|
]);
|
|
|
|
$version = PolicyVersion::create([
|
|
'tenant_id' => $tenant->id,
|
|
'policy_id' => $policy->id,
|
|
'version_number' => 1,
|
|
'policy_type' => 'enrollmentRestriction',
|
|
'platform' => 'all',
|
|
'created_by' => 'tester@example.com',
|
|
'captured_at' => CarbonImmutable::now(),
|
|
'snapshot' => [
|
|
'@odata.type' => '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration',
|
|
'deviceEnrollmentConfigurationType' => 'windows10EnrollmentCompletionPageConfiguration',
|
|
'displayName' => 'ESP Misclassified',
|
|
],
|
|
]);
|
|
|
|
$this->artisan('intune:reclassify-enrollment-configurations', ['--tenant' => $tenant->tenant_id])
|
|
->assertSuccessful();
|
|
|
|
$version->refresh();
|
|
$policy->refresh();
|
|
|
|
expect($version->policy_type)->toBe('enrollmentRestriction');
|
|
expect($policy->policy_type)->toBe('enrollmentRestriction');
|
|
|
|
$this->artisan('intune:reclassify-enrollment-configurations', ['--tenant' => $tenant->tenant_id, '--write' => true])
|
|
->assertSuccessful();
|
|
|
|
$version->refresh();
|
|
$policy->refresh();
|
|
|
|
expect($version->policy_type)->toBe('windowsEnrollmentStatusPage');
|
|
expect($policy->policy_type)->toBe('windowsEnrollmentStatusPage');
|
|
});
|