create(); $project = Project::factory()->for($tenant)->create([ 'is_active' => true, // легаси FK НЕ заполнены (Plan 3+ архитектура): 'supplier_b1_project_id' => null, 'supplier_b2_project_id' => null, 'supplier_b3_project_id' => null, ]); $sp = SupplierProject::factory()->create([ 'inactive_since' => null, ]); \DB::table('project_supplier_links')->insert([ 'project_id' => $project->id, 'supplier_project_id' => $sp->id, 'platform' => $sp->platform, 'subject_code' => null, ]); (new CleanupInactiveSupplierProjectsJob)->handle(app(\App\Services\Supplier\SupplierPortalClient::class)); expect($sp->fresh()->inactive_since)->toBeNull(); }); it('marks supplier_project inactive when no pivot link exists', function () { $sp = SupplierProject::factory()->create(['inactive_since' => null]); // нет project_supplier_links (new CleanupInactiveSupplierProjectsJob)->handle(app(\App\Services\Supplier\SupplierPortalClient::class)); expect($sp->fresh()->inactive_since)->not->toBeNull(); });