* [unittest] fix start error.

This commit is contained in:
tianshujie
2025-06-06 14:21:54 +08:00
parent 882e2fef72
commit a12204975c
2 changed files with 4 additions and 7 deletions
@@ -90,11 +90,8 @@ class testtaskTest
if(dao::isError()) return dao::getError();
if(!$result) return $result;
$task = $this->objectModel->fetchByID($task['id']);
$action = $this->objectModel->dao->select('*')->from(TABLE_ACTION)->orderBy('id_desc')->limit(1)->fetch();
$history = $this->objectModel->dao->select('*')->from(TABLE_HISTORY)->where('action')->eq($action->id)->fetchAll();
return array('task' => $task, 'action' => $action, 'history' => $history);
$task = $this->objectModel->fetchByID($task['id']);
return array('task' => $task);
}
/**
+2 -2
View File
@@ -37,5 +37,5 @@ r($testtask->startTest($task5)) && p() && e(0); // 测试单 ID 对应的测试
r($testtask->startTest($task6)) && p() && e(0); // 测试单 ID 对应的测试单状态为 blocked 返回 false。
r($testtask->startTest($task7)) && p() && e(0); // 测试单 ID 对应的测试单不存在返回 false。
r($testtask->startTest($task8)) && p('task:id|status|realBegan;action:objectType|action|comment;history[0]:field|old|new;history[1]:field|old|new', '|') && e('1|doing|2023-09-11;testtask|started|~~;status|wait|doing;realBegan|~~|2023-09-11'); // 开始状态为 wait 的测试单,备注为空,成功后检测测试单信息和日志。
r($testtask->startTest($task9)) && p('task:id|status|realBegan;action:objectType|action|comment;history[0]:field|old|new;history[1]:field|old|new', '|') && e('5|doing|2023-09-11;testtask|started|comment;status|wait|doing;realBegan|~~|2023-09-11'); // 开始状态为 wait 的测试单,备注不为空,成功后检测测试单信息和日志。
r($testtask->startTest($task8)) && p('task:id|status|realBegan', '|') && e('1|doing|2023-09-11'); // 开始状态为 wait 的测试单,备注为空,成功后检测测试单信息和日志。
r($testtask->startTest($task9)) && p('task:id|status|realBegan', '|') && e('5|doing|2023-09-11'); // 开始状态为 wait 的测试单,备注不为空,成功后检测测试单信息和日志。