TenantAtlas/apps/platform/tests/Feature/DirectoryGroups/StartSyncTest.php
Ahmed Darrazi 2d69db2419
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 5m47s
feat: remove findings acknowledged compatibility and unify canonical operation types
2026-04-29 09:32:47 +02:00

32 lines
1.1 KiB
PHP

<?php
use App\Jobs\EntraGroupSyncJob;
use App\Services\Directory\EntraGroupSyncService;
use App\Services\Providers\ProviderOperationStartResult;
use App\Support\OperationRunType;
use Illuminate\Support\Facades\Queue;
it('starts a manual group sync by creating a run and dispatching a job', function () {
Queue::fake();
[$user, $tenant] = createUserWithTenant(role: 'owner', fixtureProfile: 'credential-enabled');
$service = app(EntraGroupSyncService::class);
$result = $service->startManualSync($tenant, $user);
$run = $result->run;
expect($result)->toBeInstanceOf(ProviderOperationStartResult::class)
->and($result->status)->toBe('started');
expect($run)
->and($run->tenant_id)->toBe($tenant->getKey())
->and($run->user_id)->toBe($user->getKey())
->and($run->type)->toBe(OperationRunType::DirectoryGroupsSync->value)
->and($run->status)->toBe('queued')
->and($run->context['selection_key'] ?? null)->toBe('groups-v1:all')
->and($run->context['provider_connection_id'] ?? null)->toBeInt();
Queue::assertPushed(EntraGroupSyncJob::class);
});