From 93dbd3b13dc7fa3ab60d6652364989febcfe3064 Mon Sep 17 00:00:00 2001 From: ahmido Date: Thu, 8 Jan 2026 00:41:46 +0000 Subject: [PATCH] fix(tests): remove per-file TestCase uses (#45) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://git.cloudarix.de/ahmido/TenantAtlas/pulls/45 --- .../RunBackupScheduleJobTest.php | 3 +++ .../AppProtectionPolicyNormalizerTest.php | 3 --- tests/Unit/AssignmentBackupServiceTest.php | 4 +-- tests/Unit/AssignmentFetcherTest.php | 4 +-- tests/Unit/AssignmentFilterResolverTest.php | 4 +-- tests/Unit/AssignmentRestoreServiceTest.php | 3 --- tests/Unit/BackupItemTest.php | 4 +-- .../ScheduleTimeServiceTest.php | 3 --- tests/Unit/BulkActionPermissionTest.php | 4 +-- tests/Unit/BulkBackupSetDeleteJobTest.php | 4 +-- .../Unit/BulkBackupSetForceDeleteJobTest.php | 4 +-- tests/Unit/BulkBackupSetRestoreJobTest.php | 4 +-- tests/Unit/BulkOperationAbortMethodTest.php | 3 +-- tests/Unit/BulkOperationRunProgressTest.php | 4 +-- tests/Unit/BulkPolicyDeleteJobTest.php | 4 +-- tests/Unit/BulkPolicyExportJobTest.php | 4 +-- .../BulkPolicyVersionForceDeleteJobTest.php | 4 +-- tests/Unit/BulkPolicyVersionPruneJobTest.php | 4 +-- .../Unit/BulkPolicyVersionRestoreJobTest.php | 4 +-- tests/Unit/BulkRestoreRunDeleteJobTest.php | 4 +-- tests/Unit/BulkRestoreRunRestoreJobTest.php | 4 +-- tests/Unit/CircuitBreakerTest.php | 4 +-- tests/Unit/CompliancePolicyNormalizerTest.php | 2 -- .../Unit/DefaultPolicyNormalizerDiffTest.php | 2 -- ...eviceConfigurationPolicyNormalizerTest.php | 2 -- tests/Unit/FoundationMappingServiceTest.php | 4 +-- tests/Unit/FoundationSnapshotServiceTest.php | 2 -- .../GraphClientEndpointResolutionTest.php | 3 --- tests/Unit/GraphClientScopeTest.php | 3 --- tests/Unit/GraphContractFallbackTest.php | 3 --- .../GraphContractRegistryActualDataTest.php | 3 --- ...ractRegistrySettingsApplySanitizerTest.php | 3 --- ...tractRegistrySettingsWriteStrategyTest.php | 3 --- tests/Unit/GraphContractRegistryTest.php | 3 --- tests/Unit/GroupResolverTest.php | 4 +-- ...edDeviceAppConfigurationNormalizerTest.php | 3 --- ...osoftGraphClientListPoliciesSelectTest.php | 2 -- tests/Unit/MicrosoftGraphClientTest.php | 3 --- tests/Unit/PolicyCaptureOrchestratorTest.php | 4 +-- tests/Unit/PolicyNormalizerRoutingTest.php | 2 -- ...cyNormalizerSettingsCatalogFlattenTest.php | 2 -- .../PolicyNormalizerSettingsCatalogTest.php | 2 -- tests/Unit/PolicyNormalizerTest.php | 3 --- tests/Unit/PolicyPickerOptionLabelTest.php | 4 --- tests/Unit/PolicySnapshotServiceTest.php | 2 -- tests/Unit/PolicyVersionEligibilityTest.php | 4 +-- tests/Unit/RbacOnboardingServiceTest.php | 4 +-- tests/Unit/RestoreRunDeletableTest.php | 4 +-- tests/Unit/RestoreRunTest.php | 4 +-- tests/Unit/ScopeTagResolverTest.php | 27 +++++++++---------- tests/Unit/ScriptsPolicyNormalizerTest.php | 3 --- .../SettingsCatalogPolicyNormalizerTest.php | 3 +-- tests/Unit/TenantCurrentTest.php | 4 +-- tests/Unit/TenantPermissionServiceTest.php | 4 +-- tests/Unit/TenantResourceConsentUrlTest.php | 4 +-- tests/Unit/TenantScopeTest.php | 4 +-- ...ndowsDriverUpdateProfileNormalizerTest.php | 3 --- 57 files changed, 45 insertions(+), 170 deletions(-) diff --git a/tests/Feature/BackupScheduling/RunBackupScheduleJobTest.php b/tests/Feature/BackupScheduling/RunBackupScheduleJobTest.php index ffed21c..b6e1af6 100644 --- a/tests/Feature/BackupScheduling/RunBackupScheduleJobTest.php +++ b/tests/Feature/BackupScheduling/RunBackupScheduleJobTest.php @@ -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(); diff --git a/tests/Unit/AppProtectionPolicyNormalizerTest.php b/tests/Unit/AppProtectionPolicyNormalizerTest.php index 10fb030..53aea48 100644 --- a/tests/Unit/AppProtectionPolicyNormalizerTest.php +++ b/tests/Unit/AppProtectionPolicyNormalizerTest.php @@ -1,9 +1,6 @@ create([ 'tenant_id' => 'tenant-123', diff --git a/tests/Unit/AssignmentFetcherTest.php b/tests/Unit/AssignmentFetcherTest.php index b634752..21dc5f5 100644 --- a/tests/Unit/AssignmentFetcherTest.php +++ b/tests/Unit/AssignmentFetcherTest.php @@ -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)); diff --git a/tests/Unit/AssignmentFilterResolverTest.php b/tests/Unit/AssignmentFilterResolverTest.php index dc6888e..e07c0da 100644 --- a/tests/Unit/AssignmentFilterResolverTest.php +++ b/tests/Unit/AssignmentFilterResolverTest.php @@ -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); diff --git a/tests/Unit/AssignmentRestoreServiceTest.php b/tests/Unit/AssignmentRestoreServiceTest.php index 5b89bd8..ef12ecb 100644 --- a/tests/Unit/AssignmentRestoreServiceTest.php +++ b/tests/Unit/AssignmentRestoreServiceTest.php @@ -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', [ diff --git a/tests/Unit/BackupItemTest.php b/tests/Unit/BackupItemTest.php index e87ffcd..21c2e0a 100644 --- a/tests/Unit/BackupItemTest.php +++ b/tests/Unit/BackupItemTest.php @@ -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' => [ diff --git a/tests/Unit/BackupScheduling/ScheduleTimeServiceTest.php b/tests/Unit/BackupScheduling/ScheduleTimeServiceTest.php index e73b14c..9ff4bbe 100644 --- a/tests/Unit/BackupScheduling/ScheduleTimeServiceTest.php +++ b/tests/Unit/BackupScheduling/ScheduleTimeServiceTest.php @@ -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; diff --git a/tests/Unit/BulkActionPermissionTest.php b/tests/Unit/BulkActionPermissionTest.php index 02e99b6..f020b6b 100644 --- a/tests/Unit/BulkActionPermissionTest.php +++ b/tests/Unit/BulkActionPermissionTest.php @@ -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(); diff --git a/tests/Unit/BulkBackupSetDeleteJobTest.php b/tests/Unit/BulkBackupSetDeleteJobTest.php index 03c9e4c..c921782 100644 --- a/tests/Unit/BulkBackupSetDeleteJobTest.php +++ b/tests/Unit/BulkBackupSetDeleteJobTest.php @@ -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(); diff --git a/tests/Unit/BulkBackupSetForceDeleteJobTest.php b/tests/Unit/BulkBackupSetForceDeleteJobTest.php index 7a2720a..a0a381e 100644 --- a/tests/Unit/BulkBackupSetForceDeleteJobTest.php +++ b/tests/Unit/BulkBackupSetForceDeleteJobTest.php @@ -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(); diff --git a/tests/Unit/BulkBackupSetRestoreJobTest.php b/tests/Unit/BulkBackupSetRestoreJobTest.php index 7966e4c..5c90980 100644 --- a/tests/Unit/BulkBackupSetRestoreJobTest.php +++ b/tests/Unit/BulkBackupSetRestoreJobTest.php @@ -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(); diff --git a/tests/Unit/BulkOperationAbortMethodTest.php b/tests/Unit/BulkOperationAbortMethodTest.php index de3b92d..27b5963 100644 --- a/tests/Unit/BulkOperationAbortMethodTest.php +++ b/tests/Unit/BulkOperationAbortMethodTest.php @@ -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(); diff --git a/tests/Unit/BulkOperationRunProgressTest.php b/tests/Unit/BulkOperationRunProgressTest.php index 039b52f..0a9e71e 100644 --- a/tests/Unit/BulkOperationRunProgressTest.php +++ b/tests/Unit/BulkOperationRunProgressTest.php @@ -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(); diff --git a/tests/Unit/BulkPolicyDeleteJobTest.php b/tests/Unit/BulkPolicyDeleteJobTest.php index 37ca156..500c1cc 100644 --- a/tests/Unit/BulkPolicyDeleteJobTest.php +++ b/tests/Unit/BulkPolicyDeleteJobTest.php @@ -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(); diff --git a/tests/Unit/BulkPolicyExportJobTest.php b/tests/Unit/BulkPolicyExportJobTest.php index 88dfb9a..95299bf 100644 --- a/tests/Unit/BulkPolicyExportJobTest.php +++ b/tests/Unit/BulkPolicyExportJobTest.php @@ -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(); diff --git a/tests/Unit/BulkPolicyVersionForceDeleteJobTest.php b/tests/Unit/BulkPolicyVersionForceDeleteJobTest.php index a90f55e..d01217e 100644 --- a/tests/Unit/BulkPolicyVersionForceDeleteJobTest.php +++ b/tests/Unit/BulkPolicyVersionForceDeleteJobTest.php @@ -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(); diff --git a/tests/Unit/BulkPolicyVersionPruneJobTest.php b/tests/Unit/BulkPolicyVersionPruneJobTest.php index 5151902..eedaa08 100644 --- a/tests/Unit/BulkPolicyVersionPruneJobTest.php +++ b/tests/Unit/BulkPolicyVersionPruneJobTest.php @@ -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(); diff --git a/tests/Unit/BulkPolicyVersionRestoreJobTest.php b/tests/Unit/BulkPolicyVersionRestoreJobTest.php index fc992a6..0faecf8 100644 --- a/tests/Unit/BulkPolicyVersionRestoreJobTest.php +++ b/tests/Unit/BulkPolicyVersionRestoreJobTest.php @@ -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(); diff --git a/tests/Unit/BulkRestoreRunDeleteJobTest.php b/tests/Unit/BulkRestoreRunDeleteJobTest.php index fc3e6c6..b87f894 100644 --- a/tests/Unit/BulkRestoreRunDeleteJobTest.php +++ b/tests/Unit/BulkRestoreRunDeleteJobTest.php @@ -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(); diff --git a/tests/Unit/BulkRestoreRunRestoreJobTest.php b/tests/Unit/BulkRestoreRunRestoreJobTest.php index 3e53f64..817c36d 100644 --- a/tests/Unit/BulkRestoreRunRestoreJobTest.php +++ b/tests/Unit/BulkRestoreRunRestoreJobTest.php @@ -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(); diff --git a/tests/Unit/CircuitBreakerTest.php b/tests/Unit/CircuitBreakerTest.php index b1bb4ef..4619f8b 100644 --- a/tests/Unit/CircuitBreakerTest.php +++ b/tests/Unit/CircuitBreakerTest.php @@ -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(); diff --git a/tests/Unit/CompliancePolicyNormalizerTest.php b/tests/Unit/CompliancePolicyNormalizerTest.php index 2ef9b53..9e6d1fd 100644 --- a/tests/Unit/CompliancePolicyNormalizerTest.php +++ b/tests/Unit/CompliancePolicyNormalizerTest.php @@ -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); diff --git a/tests/Unit/DefaultPolicyNormalizerDiffTest.php b/tests/Unit/DefaultPolicyNormalizerDiffTest.php index 8774a84..3c2dcbf 100644 --- a/tests/Unit/DefaultPolicyNormalizerDiffTest.php +++ b/tests/Unit/DefaultPolicyNormalizerDiffTest.php @@ -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); diff --git a/tests/Unit/DeviceConfigurationPolicyNormalizerTest.php b/tests/Unit/DeviceConfigurationPolicyNormalizerTest.php index 913dd2d..2ab6109 100644 --- a/tests/Unit/DeviceConfigurationPolicyNormalizerTest.php +++ b/tests/Unit/DeviceConfigurationPolicyNormalizerTest.php @@ -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); diff --git a/tests/Unit/FoundationMappingServiceTest.php b/tests/Unit/FoundationMappingServiceTest.php index 51a73ca..21d91bd 100644 --- a/tests/Unit/FoundationMappingServiceTest.php +++ b/tests/Unit/FoundationMappingServiceTest.php @@ -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 = []; diff --git a/tests/Unit/FoundationSnapshotServiceTest.php b/tests/Unit/FoundationSnapshotServiceTest.php index e9c4c84..3c644a3 100644 --- a/tests/Unit/FoundationSnapshotServiceTest.php +++ b/tests/Unit/FoundationSnapshotServiceTest.php @@ -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 diff --git a/tests/Unit/GraphClientEndpointResolutionTest.php b/tests/Unit/GraphClientEndpointResolutionTest.php index 532b799..8c0cf74 100644 --- a/tests/Unit/GraphClientEndpointResolutionTest.php +++ b/tests/Unit/GraphClientEndpointResolutionTest.php @@ -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'); diff --git a/tests/Unit/GraphClientScopeTest.php b/tests/Unit/GraphClientScopeTest.php index 26bfdca..044fabb 100644 --- a/tests/Unit/GraphClientScopeTest.php +++ b/tests/Unit/GraphClientScopeTest.php @@ -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(); diff --git a/tests/Unit/GraphContractFallbackTest.php b/tests/Unit/GraphContractFallbackTest.php index 29e2f5b..ee320a8 100644 --- a/tests/Unit/GraphContractFallbackTest.php +++ b/tests/Unit/GraphContractFallbackTest.php @@ -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', [ diff --git a/tests/Unit/GraphContractRegistryActualDataTest.php b/tests/Unit/GraphContractRegistryActualDataTest.php index e61bf72..571b850 100644 --- a/tests/Unit/GraphContractRegistryActualDataTest.php +++ b/tests/Unit/GraphContractRegistryActualDataTest.php @@ -1,9 +1,6 @@ registry = app(GraphContractRegistry::class); diff --git a/tests/Unit/GraphContractRegistrySettingsApplySanitizerTest.php b/tests/Unit/GraphContractRegistrySettingsApplySanitizerTest.php index cf7ea66..17a5c0d 100644 --- a/tests/Unit/GraphContractRegistrySettingsApplySanitizerTest.php +++ b/tests/Unit/GraphContractRegistrySettingsApplySanitizerTest.php @@ -1,9 +1,6 @@ set('graph_contracts.types.settingsCatalogPolicy', [ diff --git a/tests/Unit/GraphContractRegistrySettingsWriteStrategyTest.php b/tests/Unit/GraphContractRegistrySettingsWriteStrategyTest.php index 2f848f8..a534d1d 100644 --- a/tests/Unit/GraphContractRegistrySettingsWriteStrategyTest.php +++ b/tests/Unit/GraphContractRegistrySettingsWriteStrategyTest.php @@ -1,9 +1,6 @@ set('graph_contracts.types.settingsCatalogPolicy', [ diff --git a/tests/Unit/GraphContractRegistryTest.php b/tests/Unit/GraphContractRegistryTest.php index cab3469..703cd30 100644 --- a/tests/Unit/GraphContractRegistryTest.php +++ b/tests/Unit/GraphContractRegistryTest.php @@ -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', [ diff --git a/tests/Unit/GroupResolverTest.php b/tests/Unit/GroupResolverTest.php index 2611fc9..78042bd 100644 --- a/tests/Unit/GroupResolverTest.php +++ b/tests/Unit/GroupResolverTest.php @@ -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); diff --git a/tests/Unit/ManagedDeviceAppConfigurationNormalizerTest.php b/tests/Unit/ManagedDeviceAppConfigurationNormalizerTest.php index 03266bc..e47c841 100644 --- a/tests/Unit/ManagedDeviceAppConfigurationNormalizerTest.php +++ b/tests/Unit/ManagedDeviceAppConfigurationNormalizerTest.php @@ -1,9 +1,6 @@ set('graph.client_id', 'client-id'); diff --git a/tests/Unit/PolicyCaptureOrchestratorTest.php b/tests/Unit/PolicyCaptureOrchestratorTest.php index 2bfc775..3debf5d 100644 --- a/tests/Unit/PolicyCaptureOrchestratorTest.php +++ b/tests/Unit/PolicyCaptureOrchestratorTest.php @@ -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', diff --git a/tests/Unit/PolicyNormalizerRoutingTest.php b/tests/Unit/PolicyNormalizerRoutingTest.php index 50be439..d82b937 100644 --- a/tests/Unit/PolicyNormalizerRoutingTest.php +++ b/tests/Unit/PolicyNormalizerRoutingTest.php @@ -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); diff --git a/tests/Unit/PolicyNormalizerSettingsCatalogFlattenTest.php b/tests/Unit/PolicyNormalizerSettingsCatalogFlattenTest.php index 19be69c..2325281 100644 --- a/tests/Unit/PolicyNormalizerSettingsCatalogFlattenTest.php +++ b/tests/Unit/PolicyNormalizerSettingsCatalogFlattenTest.php @@ -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 () { diff --git a/tests/Unit/PolicyNormalizerSettingsCatalogTest.php b/tests/Unit/PolicyNormalizerSettingsCatalogTest.php index 129c5bb..8ba0a14 100644 --- a/tests/Unit/PolicyNormalizerSettingsCatalogTest.php +++ b/tests/Unit/PolicyNormalizerSettingsCatalogTest.php @@ -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 () { diff --git a/tests/Unit/PolicyNormalizerTest.php b/tests/Unit/PolicyNormalizerTest.php index a4cba28..1f1a29c 100644 --- a/tests/Unit/PolicyNormalizerTest.php +++ b/tests/Unit/PolicyNormalizerTest.php @@ -1,9 +1,6 @@ normalizer = app(PolicyNormalizer::class); diff --git a/tests/Unit/PolicyPickerOptionLabelTest.php b/tests/Unit/PolicyPickerOptionLabelTest.php index ae24d71..e3d82fc 100644 --- a/tests/Unit/PolicyPickerOptionLabelTest.php +++ b/tests/Unit/PolicyPickerOptionLabelTest.php @@ -1,9 +1,5 @@ toBe('1234abcd'); diff --git a/tests/Unit/PolicySnapshotServiceTest.php b/tests/Unit/PolicySnapshotServiceTest.php index e3100ad..36adc77 100644 --- a/tests/Unit/PolicySnapshotServiceTest.php +++ b/tests/Unit/PolicySnapshotServiceTest.php @@ -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 diff --git a/tests/Unit/PolicyVersionEligibilityTest.php b/tests/Unit/PolicyVersionEligibilityTest.php index daac299..a04d791 100644 --- a/tests/Unit/PolicyVersionEligibilityTest.php +++ b/tests/Unit/PolicyVersionEligibilityTest.php @@ -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]); diff --git a/tests/Unit/RbacOnboardingServiceTest.php b/tests/Unit/RbacOnboardingServiceTest.php index 750ce5e..40d2c6e 100644 --- a/tests/Unit/RbacOnboardingServiceTest.php +++ b/tests/Unit/RbacOnboardingServiceTest.php @@ -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); }); diff --git a/tests/Unit/RestoreRunDeletableTest.php b/tests/Unit/RestoreRunDeletableTest.php index fa61f1c..fe91521 100644 --- a/tests/Unit/RestoreRunDeletableTest.php +++ b/tests/Unit/RestoreRunDeletableTest.php @@ -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(); diff --git a/tests/Unit/RestoreRunTest.php b/tests/Unit/RestoreRunTest.php index 65352a5..de7fbd5 100644 --- a/tests/Unit/RestoreRunTest.php +++ b/tests/Unit/RestoreRunTest.php @@ -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' => [ diff --git a/tests/Unit/ScopeTagResolverTest.php b/tests/Unit/ScopeTagResolverTest.php index b83ad10..cd64002 100644 --- a/tests/Unit/ScopeTagResolverTest.php +++ b/tests/Unit/ScopeTagResolverTest.php @@ -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']); }); - diff --git a/tests/Unit/ScriptsPolicyNormalizerTest.php b/tests/Unit/ScriptsPolicyNormalizerTest.php index 61a63a7..2180a34 100644 --- a/tests/Unit/ScriptsPolicyNormalizerTest.php +++ b/tests/Unit/ScriptsPolicyNormalizerTest.php @@ -1,9 +1,6 @@ 'b0091e5d-944f-4a34-bcd9-12cbfb7b75cf', diff --git a/tests/Unit/WindowsDriverUpdateProfileNormalizerTest.php b/tests/Unit/WindowsDriverUpdateProfileNormalizerTest.php index 226e594..ed7380f 100644 --- a/tests/Unit/WindowsDriverUpdateProfileNormalizerTest.php +++ b/tests/Unit/WindowsDriverUpdateProfileNormalizerTest.php @@ -1,9 +1,6 @@