<?php
declare(strict_types=1);require __DIR__.'/native.php';require __DIR__.'/CoreGate.php';require __DIR__.'/data.php';require __DIR__.'/dto.php';CoreGate::$scenario='W1_DISEASE_EDIT';CoreGate::$started=time();$schema=json_decode(file_get_contents($runtime.'/schema.json'),true);$fields=['user_id'=>actor()['user_id'],'disease_type'=>4,'store_id'=>10001,'create_time'=>time(),'update_time'=>time()];$b=[];foreach($fields as $k=>$v)$b[$k]=[$v,1];$sql='INSERT INTO yoshop_user_disease ('.implode(',',array_keys($fields)).') VALUES (:'.implode(',:',array_keys($fields)).')';$checks=[];$try=static function($name,$ok,$fn)use(&$checks){$got=true;try{$fn();}catch(Throwable $e){$got=false;}$checks[$name]=$got===$ok;ck($checks[$name],$name);};$try('own_exact_INSERT',true,static function()use($sql,$b){CoreGate::plan('AI',$sql,$b);});$bad=$b;$bad['user_id'][0]++;$try('foreign_actor_reject',false,static function()use($sql,$bad){CoreGate::plan('AI',$sql,$bad);});$try('UPDATE_reject',false,static function(){CoreGate::kind('AI','UPDATE yoshop_staff SET weight=1');});$try('DELETE_reject',false,static function(){CoreGate::kind('AI','DELETE FROM yoshop_user_disease');});$try('DDL_reject',false,static function(){CoreGate::kind('AI','CREATE TABLE x(a INT)');});$try('unknown_data_reject',false,static function(){CoreGate::kind('AI','SELECT * FROM yoshop_order');});$try('empty_metadata_reject',false,static function(){CoreGate::plan('AI',CoreGate::COLUMNS,['p'=>['',2]]);});saveOnce('expected-DTO.json',['W1_DISEASE_EDIT'=>'恭喜您，信息修改成功','R1_DISEASE_INFO'=>expectedInfo()]);saveOnce('pure-gate-result.json',['checks'=>$checks,'SQL'=>0,'HTTP'=>0,'DML'=>0]);echo json_encode(['lane'=>$lane,'pure_checks'=>count($checks),'SQL'=>0,'HTTP'=>0,'DML'=>0]),"\n";
