11 lines
3.5 KiB
PHP
11 lines
3.5 KiB
PHP
<?php require __DIR__.'/boot-QA.php';
|
|
use Illuminate\Support\Facades\DB;
|
|
$checks=[];$check=function($n,$v)use(&$checks){if(!$v)throw new RuntimeException($n);$checks[$n]=true;};$sectors=app(App\Services\SectorInvestment::class);$path=app(App\Services\InvestorPath::class);$desk=app(App\Services\VirtualDesk::class);$fin=app(App\Services\FintechInvestment::class);
|
|
$s=$sectors->sector('mercado-financeiro');config(['investor-path.enabled'=>false]);$v=$sectors->publicView($s);$check('unavailable_path_has_visible_reason',$v['start_href']===null&&strlen($v['start_notice'])>20);config(['investor-path.enabled'=>true,'portal.profile_access_enabled'=>false]);$v=$sectors->publicView($s);$check('unavailable_registration_has_visible_reason',$v['register_href']===null&&strlen($v['register_notice'])>20);config(['portal.profile_access_enabled'=>true]);
|
|
$p=json_decode(file_get_contents(__DIR__.'/CENARIOS-FINAIS-QA.json'),true);foreach($p['scenarios']as$scenario){$actor=App\Models\User::findOrFail($scenario['user_id']);$v=$path->view($actor,$scenario['id']);$check($scenario['scenario'].'_final_profile_recovered',$v['fintech']['record']['sha256']===$scenario['profile_sha256']);$expected=$scenario['scenario']==='A'?0:1;$check($scenario['scenario'].'_final_activity_scope',count(array_filter($v['fintech']['requirements'],fn($q)=>$q['state']==='applicable'))===$expected);$check($scenario['scenario'].'_only_changed_technical_review_outstanding',$v['fintech']['affected_reviews']===['S17']);$check($scenario['scenario'].'_synthetic_file_available',DB::table('documents')->where('id',$scenario['document_id'])->whereNull('deleted_at')->where('malware_scan_status','clean')->exists());
|
|
$profile=$scenario['profile'];$profile['documents']['external']=$p['scenarios'][$scenario['scenario']==='A'?1:0]['document_id'];try{$fin->save($actor,$scenario['id'],['version'=>$v['case']['version'],'profile'=>$profile]);$check('foreign_doc_refused',false);}catch(Illuminate\Validation\ValidationException$e){$check($scenario['scenario'].'_document_error_names_exact_field',isset($e->errors()['profile.documents.external']));}
|
|
}
|
|
$trio=json_decode(file_get_contents(dirname(__DIR__).'/investmoz-legado-trio-QA-20261015/PROVA-TRIO-QA.json'),true);$origins=[];
|
|
foreach($trio['QA_dossiers']as$c){$actor=App\Models\User::findOrFail($c['owner_id']);$before=$path->view($actor,$c['id']);app(App\Services\LegacyContent::class)->attach($actor,$c['id'],['version'=>$before['case']['version'],'resource_id'=>$c['resource_id']]);$v=$path->view($actor,$c['id']);$check('article_continue_keeps_sector_'.$c['slug'],count($v['content_sources'])===1&&count($v['sector_contexts'])===1&&$v['sector_contexts'][0]['slug']===$trio['resolved_origins'][array_search($c['slug'],array_column($trio['resolved_origins'],'slug'))]['sector']['slug']);app(App\Services\LegacyContent::class)->attach($actor,$c['id'],['version'=>$v['case']['version'],'resource_id'=>$c['resource_id']]);$check('article_context_replay_no_write_'.$c['slug'],$desk->case($actor,$c['id'])->version===$v['case']['version']);if($c['slug']!=='tech-fintech')$check('no_fintech_form_in_unrelated_'.$c['slug'],$v['fintech']===null);$origins[]=['case_id'=>$c['id'],'source_id'=>$c['resource_id'],'sector'=>$v['sector_contexts'][0]['slug']];}
|
|
file_put_contents(__DIR__.'/PROVA-FINAL-DELTA-QA.json',json_encode(['result'=>'passed','checks'=>$checks,'existing_dossiers_reused'=>$origins,'active_changes'=>0],JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR));echo json_encode(['result'=>'passed','checks'=>count($checks),'new_dossiers'=>0,'active_changes'=>0]);
|