<?php
declare(strict_types=1);require __DIR__.'/common.php';$check(!file_exists($runtime.'/tokens.json'),'Own new login state once');$snapshot=json_decode(file_get_contents(__DIR__.'/source-frozen-sha.json'),true)['files'];foreach($snapshot as $name=>$sha)$check(hash_file('sha256',$root.'/'.$name)===$sha,'Whole original source pin '.$name);$before=$small();foreach($before as $rows)$check($rows===[],'Fresh all method scopes zero');$protectedBefore=$protected();$check(count($protectedBefore['nutrition_meals'])===3&&count($protectedBefore['nutrition_lack'])===7,'Original retained 13 survey state');$app=invApp($root,$runtime,'AUTH_SETUP');$profiles=[];$tokens=[];
foreach($operators as $i=>$id){$model=\app\store\model\store\User::withoutGlobalScope()->where('store_user_id','=',$id)->where('store_id','=',$tenants[$i])->find();$check($model!==null,'Actual own original operator profile');$profile=$model->toArray();$check(!array_key_exists('password',$profile)&&(int)$profile['store_user_id']===$id&&(int)$profile['store_id']===$tenants[$i]&&(int)$profile['is_super']===1&&(int)$profile['is_delete']===0&&strpos($profile['user_name'],'cdxop11f64c_')===0,'Real marked super profile/tenant unchanged');$name=$i===0?'one':'two';$tokens[$name]=bin2hex(random_bytes(24));$app->cache->set($tokens[$name],['user'=>$profile,'store_id'=>$tenants[$i],'is_login'=>true],3600);$profiles[$name]=['store_user_id'=>$id,'store_id'=>$tenants[$i],'create_by'=>$profile['real_name']?:$profile['user_name']?:$id];}
$cases=json_decode(file_get_contents(__DIR__.'/cases-'.$lane.'.json'),true);foreach($cases as &$case){$case['create_by']=$profiles['one']['create_by'];$case['source_stage']='original';}unset($case);$persist('cases-original.json',$cases);$persist('tokens.json',$tokens);$persist('auth-profiles.json',$profiles);$persist('batch-before.json',['protected'=>$protectedBefore,'new_scope'=>$before,'dictionary'=>$read('SELECT * FROM yoshop_config_enum WHERE enum_type IN (6,7,8,9,10,11) AND is_delete=0 ORDER BY enum_type,'.($dm?'"ORDER"':'`order`'))]);echo json_encode(['lane'=>$lane,'auth_profiles_actual'=>2,'source_files'=>count($snapshot),'new_scopes_zero'=>true,'HTTP'=>0,'DML'=>0,'DDL'=>0]),"\n";
