Files
Investidor-V2/tools/opportunity-semantic-fixtures-qa.php
T
nala 01405cbf8a
tests / ci (push) Canceled after 0s
oportunidades 5
2026-10-10 14:15:28 +02:00

23 lines
1.5 KiB
PHP

<?php
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
require dirname(__DIR__).'/vendor/autoload.php';
require __DIR__.'/portal-qa-environment.php';
$target=portalQaEnvironment();
$app=require dirname(__DIR__).'/bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
portalQaAssertTarget($target);
$dir=dirname(__DIR__).'/storage/app/private/investmoz-v2/portal-audit';
$fixture=json_decode(file_get_contents($dir.'/opportunity-workflow-fixtures-qa.json'),true,512,JSON_THROW_ON_ERROR);
$version=DB::table('economic_activities')->where('id',$fixture['activity_id'])->value('catalog_version_id');
$existing=DB::table('authorities')->where('catalog_version_id',$version)->where('code','QA-OP-SEMANTIC')->first();
$id=$existing?->id ?? (string)Str::uuid();
if(!$existing)DB::table('authorities')->insert(['id'=>$id,'catalog_version_id'=>$version,'organization_id'=>$fixture['organization_id'],
'code'=>'QA-OP-SEMANTIC','authority_type'=>'qa-synthetic','label_pt_mz'=>'Entidade emissora sintética QA — sem competência real',
'source_reference'=>'Synthetic QA fixture only; not an official source or authority','valid_from'=>'2026-01-01','status'=>'published']);
$proof=['target'=>$target,'active_writes'=>0,'authority_id'=>$id,'source'=>'QA-synthetic; never import into active data','created'=>$existing===null];
file_put_contents($dir.'/opportunity-semantic-fixtures-qa.json',json_encode($proof,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));
echo json_encode($proof,JSON_THROW_ON_ERROR);