diff --git a/module/execution/model.php b/module/execution/model.php index 5e16ed8d6f..53d9a99a80 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -4605,6 +4605,7 @@ class executionModel extends model } /** + * 追加任务列表到执行列表。 * Append tasks to execution list. * * @param array $tasks diff --git a/module/execution/test/execution.class.php b/module/execution/test/execution.class.php index 22afe7ee13..a420e4ded5 100644 --- a/module/execution/test/execution.class.php +++ b/module/execution/test/execution.class.php @@ -3021,4 +3021,18 @@ class executionTest $executions = $this->executionModel->getStatData(); return $this->executionModel->generateRow($executions, array(), array()); } + + /** + * Test appendTasks method. + * + * @access public + * @return array + */ + public function appendTasksTest() + { + $executions = $this->executionModel->getStatData(0, 'all', 0, 0, true); + if(empty($executions[0]->tasks)) return false; + + return $this->executionModel->appendTasks($executions[0]->tasks, array()); + } } diff --git a/module/execution/test/model/appendtasks.php b/module/execution/test/model/appendtasks.php new file mode 100644 index 0000000000..835320b5ad --- /dev/null +++ b/module/execution/test/model/appendtasks.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +id->range('1-5'); +$execution->name->range('1-5')->prefix('执行'); +$execution->type->range('sprint,stage,kanban'); +$execution->status->range('wait{3},suspended,closed,doing'); +$execution->openedBy->range('admin,user1'); +$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->gen(5); + +$task = zdTable('task'); +$task->execution->range('1-3'); +$task->project->range('0'); +$task->gen(10); + +su('admin'); + +/** + +title=测试 executionModel->appendTasks(); +timeout=0 +cid=1 + +*/ + +$executionTester = new executionTest(); +$executions = $executionTester->appendTasksTest(); + +r(count($executions)) && p() && e('4'); // 判断执行数量 +r($executions) && p('0:execution,status') && e('1,wait'); // 判断第一个执行的名称 +r($executions) && p('3:rawID,progress') && e('10,57'); // 查看获取到的第三个执行的开始日期和结束日期