actingAs($user); BackupSchedule::query()->create([ 'tenant_id' => $tenant->id, 'name' => 'Daily 10:00', 'is_enabled' => true, 'timezone' => 'UTC', 'frequency' => 'daily', 'time_of_day' => '10:00:00', 'days_of_week' => null, 'policy_types' => ['deviceConfiguration'], 'include_foundations' => true, 'retention_keep_last' => 30, 'next_run_at' => null, ]); Bus::fake(); $dispatcher = app(BackupScheduleDispatcher::class); $dispatcher->dispatchDue([$tenant->external_id]); $dispatcher->dispatchDue([$tenant->external_id]); expect(BackupScheduleRun::query()->count())->toBe(1); Bus::assertDispatchedTimes(RunBackupScheduleJob::class, 1); });