from pathlib import Path import json R=Path(__file__).resolve().parent.parent;P=R/'storage/app/private/investmoz-v2/portal-audit' plan=json.loads((P/'internal-designation-plan.json').read_text());S=Path(plan['source']) assert S.parent==P and plan['target']['port']==55441 fixture=(R/'tools/portal-onboarding-governance-fixture.php').read_text(encoding='utf-8') fixture=fixture.replace("['holder','other_holder','validator']", "['holder','other_holder','promoter','validator','publisher']") fixture=fixture.replace("'opportunities'=>$db::table('opportunities')->count()", "'organizations'=>$db::table('organizations')->get(['id','name','external_id'])->all(),'memberships'=>$db::table('memberships')->count(),'external_requests'=>$db::table('portal_profile_requests')->count(),'organization_registrations'=>$db::table('audit_events')->where('action','operator_organization_registered')->count(),'opportunities'=>$db::table('opportunities')->get(['id','organization_id','owner_user_id','workflow_context'])->all()") fixture=fixture.replace("file_put_contents($private,json_encode", "Illuminate\\Support\\Facades\\DB::table('organizations')->insert(['id'=>(string)Illuminate\\Support\\Str::uuid(),'name'=>'Synthetic real promoter QA','organization_type'=>'private']);\nfile_put_contents($private,json_encode") (S/'tools').mkdir(exist_ok=True);(S/'tools/internal-fixture.php').write_text(fixture,encoding='utf-8') (S/'tools/internal-router.php').write_text('''