#!/usr/bin/env php formatDatetimeTest()) && p('name') && e('0'); // 空对象没有name属性应该返回0 // 步骤2:带有零日期的日期字段 $taskWithZeroDate = new stdclass(); $taskWithZeroDate->deadline = '0000-00-00'; r($task->formatDatetimeTest($taskWithZeroDate)) && p('deadline') && e('~~'); // 零日期应该转换为null // 步骤3:带有正常日期的日期字段 $taskWithValidDate = new stdclass(); $taskWithValidDate->deadline = '2023-12-31'; r($task->formatDatetimeTest($taskWithValidDate)) && p('deadline') && e('2023-12-31'); // 正常日期应该保持不变 // 步骤4:带有空字符串的日期字段 $taskWithEmptyString = new stdclass(); $taskWithEmptyString->finishedDate = ''; r($task->formatDatetimeTest($taskWithEmptyString)) && p('finishedDate') && e('~~'); // 空字符串应该转换为null // 步骤5:带有null值的日期字段 $taskWithNull = new stdclass(); $taskWithNull->canceledDate = null; r($task->formatDatetimeTest($taskWithNull)) && p('canceledDate') && e('~~'); // null值应该保持为null