32 lines
2.4 KiB
PHP
32 lines
2.4 KiB
PHP
<?php
|
|
ini_set('zend.exception_ignore_args','1');
|
|
putenv('STABILITY_QA_MODE=consumers');
|
|
$taskRoot=dirname(__DIR__,2);
|
|
$taskQA=$taskRoot.'/storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742';
|
|
$proofPath=__DIR__.'/case32-published-tasks-readonly-20261014.json';
|
|
if(is_file($proofPath)){throw new RuntimeException('Preservar prova anterior.');}
|
|
$app=require $taskQA.'/tools/portal-stability-runtime.php';
|
|
$db=Illuminate\Support\Facades\DB::connection();
|
|
$target=(array)$db->selectOne('SELECT current_database() AS database, inet_server_port() AS port');
|
|
if($target!==['database'=>'stability_consumers_20261011_084534_test','port'=>55441]){throw new RuntimeException('QA isolada obrigatória.');}
|
|
$db->beginTransaction();$db->statement('SET TRANSACTION READ ONLY');
|
|
try{
|
|
$record=App\Models\Opportunity::findOrFail(32);$context=$record->workflow_context??[];$tasks=[];
|
|
foreach(['review_task_id','publication_task_id','correction_task_id']as$key){
|
|
$id=$context[$key]??null;
|
|
$row=$id?$db->table('tasks')->where('id',$id)->where('source_system','opportunity-workflow')->first(['id','external_id','task_type','status','assignee_user_id','due_at','completed_at']):null;
|
|
$tasks[]=['binding'=>$key,'present'=>$row!==null,'id'=>$row->id??null,'type'=>$row->task_type??null,
|
|
'status'=>$row->status??null,'assignee_user_id'=>$row->assignee_user_id??null,
|
|
'due_at'=>$row->due_at??null,'completed_at'=>$row->completed_at??null,
|
|
'belongs_to_case32'=>$row?str_starts_with($row->external_id,'portal-opportunity:32:'):null,
|
|
'current_cycle_binding'=>$row?str_ends_with($row->external_id,':cycle:14'):null];
|
|
}
|
|
$proof=['at'=>gmdate('c'),'base_review'=>'396c691930bc','target'=>$target,'SQL_read_only'=>true,
|
|
'case'=>32,'version'=>(int)$record->management_version,'working_state'=>app(App\Services\PortalProfileAccess::class)->state($record),
|
|
'review_cycle'=>$context['review_cycle'],'tasks'=>$tasks,'historical_tasks_not_deleted'=>true,
|
|
'UI_task_presentation_not_inferred'=>true,'reasons_titles_private_contents_not_exported'=>true,
|
|
'QA_database_changes'=>0,'active_changes'=>0];
|
|
file_put_contents($proofPath,json_encode($proof,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR).PHP_EOL);
|
|
echo json_encode($proof,JSON_THROW_ON_ERROR).PHP_EOL;
|
|
}finally{$db->rollBack();}
|