Files
Investidor-V2/outputs/investmoz-parques-integral-QA-20261018/check-final-guards.php
T
nala cf003c8623
tests / ci (push) Canceled after 0s
versao nrgocios 4
2026-10-18 15:57:06 +02:00

6 lines
1.6 KiB
PHP

<?php
require __DIR__.'/boot-QA.php';
$zone=App\Models\InvestmentZone::findOrFail('0ae14c9a-1adb-4ee7-8094-d5d54d4e75f1');$service=app(App\Services\InvestmentZoneIntegralDetails::class);$base=['id'=>(string)Illuminate\Support\Str::uuid(),'label'=>'Observação sintética líquida QA','knowledge'=>'documented','disclosure'=>false,'indicator'=>'emissions','value'=>-5,'unit'=>'tCO2e líquidas','period_start'=>'2025-01-01','period_end'=>'2025-12-31','population'=>'Unidade sintética','scope'=>'Ensaio QA','source_reference'=>'Exemplar sintético A','source_date'=>'2026-10-18'];
$a=$service->merge($zone,[],['observations'=>[$base]]);if($a['observations'][0]['value']!==-5)throw new RuntimeException('Signed measured value lost');$other=[...$base,'id'=>(string)Illuminate\Support\Str::uuid(),'source_reference'=>'Exemplar sintético B','knowledge'=>'disputed'];$a=$service->merge($zone,[],['observations'=>[$base,$other]]);if(count($a['observations'])!==2)throw new RuntimeException('Independent documentary source rejected');$duplicate=[...$base,'id'=>(string)Illuminate\Support\Str::uuid()];$refused=false;try{$service->merge($zone,[],['observations'=>[$base,$duplicate]]);}catch(Symfony\Component\HttpKernel\Exception\HttpException$e){$refused=$e->getStatusCode()===422;}if(!$refused)throw new RuntimeException('Exact duplicate accepted');
$proof=['target'=>$target,'signed_observation_preserved'=>true,'distinct_documentary_sources_preserved'=>true,'exact_duplicate_refused'=>true,'database_writes'=>0,'active_changes'=>0];file_put_contents(__DIR__.'/FINAL-GUARDS-QA.json',json_encode($proof,JSON_PRETTY_PRINT));echo json_encode($proof).PHP_EOL;