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