TenantAtlas/tests/Feature/SyncPoliciesJobDispatchTest.php

21 lines
705 B
PHP

<?php
use App\Jobs\SyncPoliciesJob;
use App\Models\OperationRun;
use Illuminate\Support\Facades\Bus;
it('dispatches SyncPoliciesJob with an OperationRun as the 4th argument', function () {
Bus::fake();
$operationRun = OperationRun::factory()->create();
SyncPoliciesJob::dispatch((int) $operationRun->tenant_id, null, null, $operationRun);
Bus::assertDispatched(SyncPoliciesJob::class, function (SyncPoliciesJob $job) use ($operationRun): bool {
return $job->tenantId === (int) $operationRun->tenant_id
&& $job->types === null
&& $job->policyIds === null
&& (int) $job->operationRun?->getKey() === (int) $operationRun->getKey();
});
});