* testtask: refactor script to test the start method.

This commit is contained in:
liugang
2023-09-11 14:55:34 +08:00
parent 8ac9c4e28f
commit b41d153e18
2 changed files with 37 additions and 7 deletions
+16 -4
View File
@@ -35,13 +35,25 @@ class testtaskTest
return $objects;
}
public function startTest($taskID)
/**
* 测试开始一个测试单。
* Test start a testtask.
*
* param array $task
* access public
* return bool|array
*/
public function startTest(array $task): bool|array
{
$objects = $this->objectModel->start($taskID);
$result = $this->objectModel->start((object)$task);
if(dao::isError()) return dao::getError();
if(!$result) return $result;
return $objects;
$task = $this->objectModel->getById($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);
}
public function closeTest($taskID)