create(); DB::statement('SET app.current_tenant_id = '.$tenant->id); $run = AutopodborRun::create([ 'tenant_id' => $tenant->id, 'kind' => 'search', 'status' => 'running', 'region_code' => 16, 'params' => [], ]); $ch = app(RunProgressChannel::class); $ch->bind($run->id); $ch->stage(2, 4, 'Ищем фирмы в справочниках'); // Порядок ключей в jsonb Postgres не сохраняет — сравниваем по парам ключ/значение. expect($run->fresh()->progress)->toEqual([ 'stage' => 2, 'total' => 4, 'label' => 'Ищем фирмы в справочниках', ]); }); it('канал без привязки (bind null) — тихо ничего не делает и не падает', function () { $ch = app(RunProgressChannel::class); $ch->bind(null); $ch->stage(1, 1, 'что-то'); expect(true)->toBeTrue(); });