<?php
declare(strict_types=1);require __DIR__.'/common.php';$cases=json_decode(file_get_contents($runtime.'/cases-original.json'),true);$tokens=json_decode(file_get_contents($runtime.'/tokens.json'),true);$port=$lane==='B'?18911:18912;$result=[];foreach(['PROBLEM_CREATE','MEALS_CREATE','FOOD_CREATE'] as $scenario){$case=$cases[$scenario];$check(!file_exists($runtime.'/client-original-'.$scenario.'.json'),'No original request replay');$headers=['Host: '.$case['host'],'Platform: POC','Content-Type: application/json','Access-Token: '.$tokens['one'],'X-Pilot-Scenario: '.$scenario];$ctx=stream_context_create(['http'=>['method'=>'POST','header'=>implode("\r\n",$headers),'content'=>$case['body_raw'],'timeout'=>120,'ignore_errors'=>true]]);$raw=file_get_contents('http://127.0.0.1:'.$port.$case['path'],false,$ctx);$persist('client-original-'.$scenario.'.json',['case'=>$case,'response_headers'=>$http_response_header,'raw'=>$raw]);$body=json_decode($raw,true);$result[$scenario]=['status'=>$body['status']??null,'message'=>$body['message']??null,'harness_error'=>$body['harness_error']??null];echo json_encode(['lane'=>$lane,'case'=>$scenario]+$result[$scenario],JSON_UNESCAPED_UNICODE),"\n";if(isset($body['harness_error']))break;}$persist('run-first-result.json',$result);
