<?php
require '/workspace/zhct/zhctproject/store/env.php';define('APP_PATH','/workspace/zhct/zhctproject/store/application/');require '/workspace/zhct/zhctproject/store/thinkphp/base.php';
set_exception_handler(static function(Throwable $e):void{echo json_encode(['passed'=>false,'class'=>get_class($e),'message'=>$e->getMessage()]),"\n";exit(2);});
require '/tmp/cdx-store-custom-category-20261010/source/application/p/logic/DishCustomCategory.php';$method=new ReflectionMethod(\app\p\logic\DishCustomCategory::class,'normalizeListDateTimes');$method->setAccessible(true);$checks=0;
$assert=static function($actual,$expected,string $why)use(&$checks):void{++$checks;if($actual!==$expected)throw new RuntimeException($why);};
$row=['id'=>7,'code'=>null,'name'=>'CDX','create_time'=>'2026-10-10 12:34:56.000000','update_time'=>'2024-02-29 23:59:59.123456','other_time'=>'2026-10-10 12:34:56.000000','nested'=>['create_time'=>'2026-10-10 12:34:56.000000']];$expected=$row;$expected['create_time']='2026-10-10 12:34:56';$expected['update_time']='2024-02-29 23:59:59';
$assert($method->invoke(null,[$row],true),[$expected],'Only two row fields');$assert($method->invoke(null,[$row],false),[$row],'MySQL fractional input full original');$assert($method->invoke(null,[],true),[],'Empty list');$assert($method->invoke(null,[['id'=>9]],true),[['id'=>9]],'Missing fields not synthesized');
foreach([null,'',1720000000,'2026-10-10 12:34:56','2026-02-29 12:34:56.000000','2026-02-30 12:34:56.000000','2026-10-10 24:00:00.000000','2026-10-10 12:34:60.000000','2026-10-10 12:34:56.1234567','2026-10-10 12:34:56.','2026-10-10T12:34:56.000000']as $v){$r=['create_time'=>$v,'update_time'=>$v];$assert($method->invoke(null,[$r],true),[$r],'Preserve invalid/nonfraction/null');}
foreach(['1','12','123','1234','12345','123456']as $fraction){$r=['create_time'=>'2026-10-10 12:34:56.'.$fraction];$assert($method->invoke(null,[$r],true),[['create_time'=>'2026-10-10 12:34:56']],'Fraction bound');}
echo json_encode(['passed'=>true,'checks'=>$checks]),"\n";
