make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();$n=json_decode(file_get_contents($s['root'].'/native-fixture.json'),true);config(['database.connections.receipt_demo'=>$s['nativeConnection']]);$db=DB::connection('receipt_demo');$checks=[];$ok=function($v,$name)use(&$checks){if(!$v)throw new RuntimeException($name);$checks[]=$name;};$fingerprint=fn()=>hash('sha256',json_encode([$db->table('requisitions')->orderBy('id')->get(),$db->table('purchase_orders')->get(),$db->table('goods_receipts')->get(),$db->table('stock_movements')->get(),$db->table('audit_logs')->orderBy('id')->get(),DB::table('geo_locations')->get()]));$before=$fingerprint(); $ok($db->table('requisitions')->where('tenant_id',$n['tenant'])->count()===0&&$db->table('goods_receipts')->count()===0&&$db->table('stock_movements')->count()===0,'warehouse demo starts before main request order or physical effects');$client=new GuzzleHttp\Client(['base_uri'=>'http://127.0.0.1:8075','http_errors'=>false,'timeout'=>25]);$jar=new GuzzleHttp\Cookie\CookieJar;$r=$client->get('/qa/enter/validator',['cookies'=>$jar]);$v=json_decode((string)$r->getBody(),true);$o=['cookies'=>$jar,'headers'=>['Accept'=>'application/json','X-SGF-Context'=>$v['context']]];$r=$client->get('/purchasing/receipts',$o);$ok($r->getStatusCode()===200&&str_contains((string)$r->getBody(),'receipt-workspace.mjs'),'live receipt workspace served');$r=$client->get('/api/purchasing-receipts',$o);$d=json_decode((string)$r->getBody(),true);$ok($r->getStatusCode()===200&&$d['data']===[],'warehouse waits for actual issued main order'); foreach(['receipt-workspace.mjs','supplier-picker-model.mjs']as$file){$r=$client->get('/'.$file);$ok($r->getStatusCode()===200&&hash('sha256',(string)$r->getBody())===hash_file('sha256',$s['app'].'/public/'.$file),'served warehouse source matches '.$file);}$ok($fingerprint()===$before,'warehouse demonstration checks preserve business and geographic facts');file_put_contents($out,json_encode(['passed'=>true,'checks'=>$checks,'before'=>$before,'after'=>$fingerprint(),'visual_review'=>false],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo count($checks)." warehouse demo checks passed.\n";