merge: origin/dev into feat/042
This commit is contained in:
commit
0aa36810c7
@ -4,6 +4,7 @@
|
||||
use App\Models\BackupSchedule;
|
||||
use App\Models\BackupScheduleRun;
|
||||
use App\Models\BackupSet;
|
||||
use App\Services\BulkOperationService;
|
||||
use App\Services\Intune\BackupService;
|
||||
use App\Services\Intune\PolicySyncService;
|
||||
use Carbon\CarbonImmutable;
|
||||
@ -71,6 +72,7 @@ public function createBackupSet($tenant, $policyIds, ?string $actorEmail = null,
|
||||
app(\App\Services\BackupScheduling\ScheduleTimeService::class),
|
||||
app(\App\Services\Intune\AuditLogger::class),
|
||||
app(\App\Services\BackupScheduling\RunErrorMapper::class),
|
||||
app(BulkOperationService::class),
|
||||
);
|
||||
|
||||
$run->refresh();
|
||||
@ -114,6 +116,7 @@ public function createBackupSet($tenant, $policyIds, ?string $actorEmail = null,
|
||||
app(\App\Services\BackupScheduling\ScheduleTimeService::class),
|
||||
app(\App\Services\Intune\AuditLogger::class),
|
||||
app(\App\Services\BackupScheduling\RunErrorMapper::class),
|
||||
app(BulkOperationService::class),
|
||||
);
|
||||
|
||||
$run->refresh();
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Intune\PolicyNormalizer;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
test('app protection normalizer formats blocked/required booleans and durations', function () {
|
||||
$normalizer = app(PolicyNormalizer::class);
|
||||
|
||||
@ -9,10 +9,8 @@
|
||||
use App\Services\Graph\ScopeTagResolver;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery\MockInterface;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
it('enriches assignment filter names when filter data is stored at root', function () {
|
||||
$tenant = Tenant::factory()->create([
|
||||
'tenant_id' => 'tenant-123',
|
||||
|
||||
@ -6,10 +6,8 @@
|
||||
use App\Services\Graph\GraphResponse;
|
||||
use App\Services\Graph\MicrosoftGraphClient;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
beforeEach(function () {
|
||||
$this->graphClient = Mockery::mock(MicrosoftGraphClient::class);
|
||||
$this->fetcher = new AssignmentFetcher($this->graphClient, app(GraphContractRegistry::class));
|
||||
|
||||
@ -5,10 +5,8 @@
|
||||
use App\Services\Graph\MicrosoftGraphClient;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
beforeEach(function () {
|
||||
Cache::flush();
|
||||
$this->graphClient = Mockery::mock(MicrosoftGraphClient::class);
|
||||
|
||||
@ -9,9 +9,6 @@
|
||||
use App\Services\Graph\GraphLogger;
|
||||
use App\Services\Graph\GraphResponse;
|
||||
use App\Services\Intune\AuditLogger;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
config()->set('graph_contracts.types.deviceManagementScript', [
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
|
||||
use App\Models\BackupItem;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('assignments cast works', function () {
|
||||
$backupItem = BackupItem::factory()->create([
|
||||
'assignments' => [
|
||||
|
||||
@ -3,9 +3,6 @@
|
||||
use App\Models\BackupSchedule;
|
||||
use App\Services\BackupScheduling\ScheduleTimeService;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
it('skips nonexistent DST local time slots for daily schedules', function () {
|
||||
$schedule = new BackupSchedule;
|
||||
|
||||
@ -7,10 +7,8 @@
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('policies bulk actions are available for authenticated users', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -8,10 +8,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('bulk backup set delete job archives sets and cascades to backup items', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -9,10 +9,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('bulk backup set force delete job permanently deletes archived sets and their items', function () {
|
||||
$tenant = Tenant::factory()->create(['is_current' => true]);
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -8,10 +8,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('bulk backup set restore job restores archived sets and their items', function () {
|
||||
$tenant = Tenant::factory()->create(['is_current' => true]);
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -6,8 +6,7 @@
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(Tests\TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
it('can abort a bulk operation run', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -4,10 +4,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('bulk operation service updates progress counters', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -6,10 +6,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('job processes bulk delete successfully', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -9,10 +9,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('job processes bulk export successfully', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -7,10 +7,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('job force deletes archived versions and skips active versions', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -7,10 +7,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('job prunes eligible versions and skips ineligible with reasons', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -8,10 +8,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('bulk policy version restore restores archived versions', function () {
|
||||
$tenant = Tenant::factory()->create(['is_current' => true]);
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -7,10 +7,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('job soft deletes deletable restore runs', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -8,10 +8,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('bulk restore run restore restores archived runs', function () {
|
||||
$tenant = Tenant::factory()->create(['is_current' => true]);
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -6,10 +6,8 @@
|
||||
use App\Models\User;
|
||||
use App\Services\BulkOperationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('bulk delete aborts when more than half of items fail', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
|
||||
use App\Services\Intune\CompliancePolicyNormalizer;
|
||||
|
||||
uses(Tests\TestCase::class);
|
||||
|
||||
it('groups compliance policy fields into structured blocks', function () {
|
||||
$normalizer = app(CompliancePolicyNormalizer::class);
|
||||
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
|
||||
use App\Services\Intune\DefaultPolicyNormalizer;
|
||||
|
||||
uses(Tests\TestCase::class);
|
||||
|
||||
it('flattens normalized settings with section prefixes for diffs', function () {
|
||||
$normalizer = app(DefaultPolicyNormalizer::class);
|
||||
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
|
||||
use App\Services\Intune\DeviceConfigurationPolicyNormalizer;
|
||||
|
||||
uses(Tests\TestCase::class);
|
||||
|
||||
it('builds a configuration block for device configuration policies', function () {
|
||||
$normalizer = app(DeviceConfigurationPolicyNormalizer::class);
|
||||
|
||||
|
||||
@ -9,10 +9,8 @@
|
||||
use App\Services\Intune\FoundationSnapshotService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery\MockInterface;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
class FoundationMappingGraphClient implements GraphClientInterface
|
||||
{
|
||||
public array $requests = [];
|
||||
|
||||
@ -5,9 +5,7 @@
|
||||
use App\Services\Graph\GraphResponse;
|
||||
use App\Services\Intune\FoundationSnapshotService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
class FoundationSnapshotGraphClient implements GraphClientInterface
|
||||
|
||||
@ -5,9 +5,6 @@
|
||||
use App\Services\Graph\MicrosoftGraphClient;
|
||||
use Illuminate\Http\Client\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
config()->set('graph.base_url', 'https://graph.microsoft.com');
|
||||
|
||||
@ -7,9 +7,6 @@
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
it('falls back to default graph scope when config is empty', function () {
|
||||
Cache::flush();
|
||||
|
||||
@ -5,9 +5,6 @@
|
||||
use App\Services\Graph\MicrosoftGraphClient;
|
||||
use Illuminate\Http\Client\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
config()->set('graph_contracts.types.deviceConfiguration', [
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Graph\GraphContractRegistry;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
$this->registry = app(GraphContractRegistry::class);
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Graph\GraphContractRegistry;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
config()->set('graph_contracts.types.settingsCatalogPolicy', [
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Graph\GraphContractRegistry;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
it('builds settings write method and path from the contract', function () {
|
||||
config()->set('graph_contracts.types.settingsCatalogPolicy', [
|
||||
|
||||
@ -2,9 +2,6 @@
|
||||
|
||||
use App\Services\Graph\GraphContractRegistry;
|
||||
use App\Services\Graph\GraphResponse;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
config()->set('graph_contracts.types.deviceConfiguration', [
|
||||
|
||||
@ -6,10 +6,8 @@
|
||||
use App\Services\Graph\MicrosoftGraphClient;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
beforeEach(function () {
|
||||
Cache::flush();
|
||||
$this->graphClient = Mockery::mock(MicrosoftGraphClient::class);
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Intune\PolicyNormalizer;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
test('managed device app configuration normalizer shows app config keys and values', function () {
|
||||
$normalizer = app(PolicyNormalizer::class);
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
uses(Tests\TestCase::class);
|
||||
|
||||
use App\Services\Graph\GraphContractRegistry;
|
||||
use App\Services\Graph\GraphLogger;
|
||||
use App\Services\Graph\MicrosoftGraphClient;
|
||||
|
||||
@ -6,9 +6,6 @@
|
||||
use Illuminate\Http\Client\RequestException as HttpRequestException;
|
||||
use Illuminate\Http\Client\Response as HttpClientResponse;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
it('returns a graph response when the HTTP client throws for a 400 response', function () {
|
||||
config()->set('graph.client_id', 'client-id');
|
||||
|
||||
@ -10,10 +10,8 @@
|
||||
use App\Services\Intune\PolicySnapshotService;
|
||||
use App\Services\Intune\VersionService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('capture returns failure when snapshot fetch fails (no exception)', function () {
|
||||
$tenant = Tenant::factory()->create([
|
||||
'tenant_id' => 'tenant-1',
|
||||
|
||||
@ -4,8 +4,6 @@
|
||||
use App\Services\Intune\PolicyNormalizer;
|
||||
use App\Services\Intune\PolicyTypeNormalizer;
|
||||
|
||||
uses(Tests\TestCase::class);
|
||||
|
||||
it('routes to the first matching policy type normalizer', function () {
|
||||
$defaultNormalizer = app(DefaultPolicyNormalizer::class);
|
||||
|
||||
|
||||
@ -4,9 +4,7 @@
|
||||
use App\Models\SettingsCatalogDefinition;
|
||||
use App\Services\Intune\PolicyNormalizer;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@ -2,9 +2,7 @@
|
||||
|
||||
use App\Services\Intune\PolicyNormalizer;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Intune\PolicyNormalizer;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
$this->normalizer = app(PolicyNormalizer::class);
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
it('shortens external ids for picker display', function () {
|
||||
expect(\App\Livewire\BackupSetPolicyPickerTable::externalIdShort('00000000-0000-0000-0000-1234abcd'))
|
||||
->toBe('1234abcd');
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
use App\Services\Graph\GraphResponse;
|
||||
use App\Services\Intune\PolicySnapshotService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
class PolicySnapshotGraphClient implements GraphClientInterface
|
||||
|
||||
@ -4,10 +4,8 @@
|
||||
use App\Models\PolicyVersion;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('pruneEligible returns only old non-current versions', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
$policy = Policy::factory()->create(['tenant_id' => $tenant->id]);
|
||||
|
||||
@ -5,10 +5,8 @@
|
||||
use App\Services\Graph\GraphResponse;
|
||||
use App\Services\Intune\RbacOnboardingService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
beforeEach(function () {
|
||||
config()->set('tenantpilot.features.conditional_access', false);
|
||||
});
|
||||
|
||||
@ -4,10 +4,8 @@
|
||||
use App\Models\RestoreRun;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('deletable scope includes only finished statuses', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
|
||||
use App\Models\RestoreRun;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
test('group_mapping cast works', function () {
|
||||
$restoreRun = RestoreRun::factory()->create([
|
||||
'group_mapping' => [
|
||||
|
||||
@ -7,17 +7,15 @@
|
||||
use App\Services\Graph\ScopeTagResolver;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
beforeEach(function () {
|
||||
Cache::flush();
|
||||
});
|
||||
|
||||
test('resolves scope tag IDs to objects with id and displayName', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
|
||||
|
||||
$mockGraphClient = Mockery::mock(MicrosoftGraphClient::class);
|
||||
$mockGraphClient->shouldReceive('request')
|
||||
->with('GET', '/deviceManagement/roleScopeTags', Mockery::on(function ($options) use ($tenant) {
|
||||
@ -39,7 +37,7 @@
|
||||
));
|
||||
|
||||
$mockLogger = Mockery::mock(GraphLogger::class);
|
||||
|
||||
|
||||
$resolver = new ScopeTagResolver($mockGraphClient, $mockLogger);
|
||||
$result = $resolver->resolve(['0', '1', '2'], $tenant);
|
||||
|
||||
@ -52,7 +50,7 @@
|
||||
|
||||
test('caches scope tag objects for 1 hour', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
|
||||
|
||||
$mockGraphClient = Mockery::mock(MicrosoftGraphClient::class);
|
||||
$mockGraphClient->shouldReceive('request')
|
||||
->once() // Only called once due to caching
|
||||
@ -66,12 +64,12 @@
|
||||
));
|
||||
|
||||
$mockLogger = Mockery::mock(GraphLogger::class);
|
||||
|
||||
|
||||
$resolver = new ScopeTagResolver($mockGraphClient, $mockLogger);
|
||||
|
||||
|
||||
// First call - fetches from API
|
||||
$result1 = $resolver->resolve(['0'], $tenant);
|
||||
|
||||
|
||||
// Second call - should use cache
|
||||
$result2 = $resolver->resolve(['0'], $tenant);
|
||||
|
||||
@ -83,7 +81,7 @@
|
||||
$tenant = Tenant::factory()->create();
|
||||
$mockGraphClient = Mockery::mock(MicrosoftGraphClient::class);
|
||||
$mockLogger = Mockery::mock(GraphLogger::class);
|
||||
|
||||
|
||||
$resolver = new ScopeTagResolver($mockGraphClient, $mockLogger);
|
||||
$result = $resolver->resolve([], $tenant);
|
||||
|
||||
@ -92,7 +90,7 @@
|
||||
|
||||
test('handles 403 forbidden gracefully', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
|
||||
|
||||
$mockGraphClient = Mockery::mock(MicrosoftGraphClient::class);
|
||||
$mockGraphClient->shouldReceive('request')
|
||||
->once()
|
||||
@ -103,7 +101,7 @@
|
||||
));
|
||||
|
||||
$mockLogger = Mockery::mock(GraphLogger::class);
|
||||
|
||||
|
||||
$resolver = new ScopeTagResolver($mockGraphClient, $mockLogger);
|
||||
$result = $resolver->resolve(['0', '1'], $tenant);
|
||||
|
||||
@ -113,7 +111,7 @@
|
||||
|
||||
test('filters returned scope tags to requested IDs', function () {
|
||||
$tenant = Tenant::factory()->create();
|
||||
|
||||
|
||||
$mockGraphClient = Mockery::mock(MicrosoftGraphClient::class);
|
||||
$mockGraphClient->shouldReceive('request')
|
||||
->once()
|
||||
@ -129,7 +127,7 @@
|
||||
));
|
||||
|
||||
$mockLogger = Mockery::mock(GraphLogger::class);
|
||||
|
||||
|
||||
$resolver = new ScopeTagResolver($mockGraphClient, $mockLogger);
|
||||
// Request only IDs 0 and 2
|
||||
$result = $resolver->resolve(['0', '2'], $tenant);
|
||||
@ -139,4 +137,3 @@
|
||||
expect($result[0])->toBe(['id' => '0', 'displayName' => 'Default']);
|
||||
expect($result[2])->toBe(['id' => '2', 'displayName' => 'Verbund-2']);
|
||||
});
|
||||
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Intune\PolicyNormalizer;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
it('normalizes deviceManagementScript into readable settings', function () {
|
||||
$normalizer = app(PolicyNormalizer::class);
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
use App\Services\Intune\SettingsCatalogPolicyNormalizer;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(Tests\TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
it('builds a settings table for settings catalog policies', function () {
|
||||
$normalizer = app(SettingsCatalogPolicyNormalizer::class);
|
||||
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
function restoreIntuneTenantId(string|false $original): void
|
||||
{
|
||||
$original !== false
|
||||
|
||||
@ -6,10 +6,8 @@
|
||||
use App\Services\Graph\GraphResponse;
|
||||
use App\Services\Intune\TenantPermissionService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
function requiredPermissions(): array
|
||||
{
|
||||
$service = app(TenantPermissionService::class);
|
||||
|
||||
@ -3,10 +3,8 @@
|
||||
use App\Filament\Resources\TenantResource;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
it('includes scope parameter in admin consent url', function () {
|
||||
// The adminConsentUrl builds scopes from intune_permissions config, not graph.scope
|
||||
$tenant = Tenant::create([
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
it('finds tenant by guid without casting to bigint', function () {
|
||||
$tenant = Tenant::create([
|
||||
'tenant_id' => 'b0091e5d-944f-4a34-bcd9-12cbfb7b75cf',
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Intune\PolicyNormalizer;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
it('normalizes windows driver update profiles into readable settings', function () {
|
||||
$normalizer = app(PolicyNormalizer::class);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user