<?php
namespace think {class Config{public static $type='mysql';public static function get($key){return $key==='database.type'?self::$type:null;}}class Exception extends \Exception{}}
namespace app\model {class Weight{public static $rows=[];public function show(...$args){return self::$rows;}public function where(...$args){return $this;}public function count(){return count(self::$rows);}public function chart(...$args){return self::$rows;}public function inquiryCount(...$args){return count(self::$rows);}}class Staff{}class User{}class Department{}class StaffDepartment{}}
namespace app\p\logic {class DateMenu{}}
namespace {
require $argv[1];$logic=new \app\p\logic\Weight();$values=[null,'',17,'2001-03-01 09:00:00','2001-03-01 09:00:00.0','2001-03-01 09:00:00.00','2001-03-01 09:00:00.000','2001-03-01 09:00:00.0000','2001-03-01 09:00:00.00000','2001-03-01 09:00:00.000000','2001-03-01 09:00:00.000001','2001-03-01 09:00:00.123456','2001-03-01 09:00:00.0000000','2001-03-01T09:00:00.000000','2026-02-29 09:00:00.000000','0000-01-01 09:00:00.000000','2024-02-29 24:00:00.000000','2024-02-29 23:60:00.000000','2024-02-29 23:59:60.000000','2024-02-29 23:59:59.000000',"2001-03-01 09:00:00.000000\n",'2001-13-01 09:00:00.000000'];$checks=[];
foreach(['mysql','app\\cores\\database\\Dm','\\app\\cores\\database\\Dm']as $type){\think\Config::$type=$type;foreach($values as $i=>$time){$rows=[['create_time'=>$time,'name'=>"兼容测试'\n完整中文",'status'=>'1','energy_value'=>0,'untouched'=>null],['create_time'=>'2001-03-02 09:00:00.000000','name'=>'兼容测试作者','status'=>'3','energy_value'=>1800]];\app\model\Weight::$rows=$rows;$expected=$rows;if($type!=='mysql'){if(($i>=4&&$i<=9)||$i===19)$expected[0]['create_time']=substr($time,0,19);$expected[1]['create_time']='2001-03-02 09:00:00';}$checks[$type.'_show_'.$i]=$logic->show(['a.staff_uuid'=>'CDX'])===['code'=>0,'message'=>'查询成功','data'=>['rows'=>$expected,'total'=>2]];}
$rows=[['name'=>null,'status'=>'2','energy_value'=>0]];\app\model\Weight::$rows=$rows;$checks[$type.'_missing_time_preserved']=$logic->show(['a.staff_uuid'=>'CDX'])===['code'=>0,'message'=>'查询成功','data'=>['rows'=>$rows,'total'=>1]];
\app\model\Weight::$rows=[];$checks[$type.'_empty_shape']=$logic->show(['a.staff_uuid'=>'CDX'])===['code'=>0,'message'=>'查询成功','data'=>['rows'=>[],'total'=>0]];
$rows=[['weight'=>0.0,'pbf'=>'0.00','ymd'=>'2001-03-01'],['weight'=>63.25,'pbf'=>'18.50','ymd'=>'2001-03-02']];\app\model\Weight::$rows=$rows;$checks[$type.'_chart_unmodified_native_numbers_CHAR_text']=$logic->chart(['staff_uuid'=>'CDX'])===['code'=>0,'message'=>'查询成功','data'=>['rows'=>$rows,'total'=>2]];}
$failed=array_keys(array_filter($checks,static function($v){return !$v;}));echo json_encode(['total'=>count($checks),'failed_count'=>count($failed),'failed'=>$failed]),"\n";exit($failed?1:0);
}
