Files
Investidor-V2/outputs/investmoz-referencias-economicas-QA-20261016/inspect-fixture.php
T
nala 2d23157e40
tests / ci (push) Canceled after 0s
versao nrgocios
2026-10-16 13:06:58 +02:00

13 lines
1.5 KiB
PHP

<?php
require __DIR__.'/boot-QA.php';
use Illuminate\Support\Facades\DB;
$before=json_decode(file_get_contents(dirname($source).'/database-before.json'),true);
$roles=DB::table('portal_role_assignments')->orderBy('id')->get()->toJson();
$same=hash('sha256',$roles)===hash('sha256',json_encode($before['portal_role_assignments']));
if(!$same)throw new RuntimeException('Role data changed');
$proof=json_decode(file_get_contents(__DIR__.'/FIXTURE-QA.json'),true);$proof['role_assignments_unchanged']=true;$proof['role_hash']=hash('sha256',$roles);file_put_contents(__DIR__.'/FIXTURE-QA.json',json_encode($proof,JSON_PRETTY_PRINT));
$pair=DB::table('portal_superuser_pair')->first(['first_user_id','second_user_id']);
$canonical=[];foreach([15,16,17,18,20,21,22,30,34,56]as$id){$o=App\Models\Opportunity::find($id);if(!$o)continue;$v=app(App\Services\OpportunityManagement::class)->values($o);$canonical[]=['id'=>$id,'status'=>$o->status,'owner'=>$o->owner_user_id,'category'=>$o->opportunity_category,'canonical_keys'=>array_keys($v['canonical']??[]),'version'=>$o->version_no,'canonical_sector'=>$v['canonical']['sector_id']??null,'subsector'=>$v['canonical']['subsector_id']??null,'activity'=>$v['canonical']['economic_activity_id']??null,'documents'=>$v['canonical']['documents']??[]];}
file_put_contents(__DIR__.'/CANONICAL-INSPECTION.json',json_encode($canonical,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE));
echo json_encode(['roles_unchanged'=>true,'pair'=>$pair,'canonical'=>$canonical,'scanner'=>app(App\Services\Malware\MalwareScanner::class)->health()],JSON_UNESCAPED_UNICODE);