diff --git a/module/execution/test/execution.class.php b/module/execution/test/execution.class.php index 5851653994..585a5fc149 100644 --- a/module/execution/test/execution.class.php +++ b/module/execution/test/execution.class.php @@ -3207,4 +3207,25 @@ class executionTest $taskGroups = $this->executionModel->getTaskGroups($executionID); return $this->executionModel->processTaskNode($node, $taskGroups); } + + /** + * 批量处理执行的名称。 + * The name of the batch process execution. + * + * @param int $projectID + * @param int $count + * @access public + * @return array|int + */ + public function batchProcessNameTest(int $projectID, int $count): array|int + { + $project = $this->executionModel->loadModel('project')->getByID($projectID); + $executions = $this->executionModel->dao->select('*')->from(TABLE_EXECUTION) + ->where('deleted')->eq(0) + ->andWhere('type')->in('sprint,stage,kanban') + ->andWhere('project')->eq($projectID) + ->fetchAll(); + + return $count ? count($executions) : $executions; + } } diff --git a/module/execution/test/model/batchprocessname.php b/module/execution/test/model/batchprocessname.php new file mode 100644 index 0000000000..216da73a26 --- /dev/null +++ b/module/execution/test/model/batchprocessname.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +gen(5); +su('admin'); + +zdTable('project')->config('execution')->gen(30); + +/** + +title=测试executionModel->batchProcessName(); +timeout=0 +cid=1 + +*/ + +$projectIdList = array(11, 60, 100); +$countList = array(0, 1); + +$executionTester = new executionTest(); +r($executionTester->batchProcessNameTest($projectIdList[0], $countList[0])) && p('2:project,name') && e('11,迭代7'); // 测试处理敏捷项目下的执行名称 +r($executionTester->batchProcessNameTest($projectIdList[1], $countList[0])) && p('2:project,name') && e('60,阶段12'); // 测试处理瀑布项目下的执行名称 +r($executionTester->batchProcessNameTest($projectIdList[2], $countList[0])) && p('2:project,name') && e('100,看板30'); // 测试处理看板项目下的执行名称 +r($executionTester->batchProcessNameTest($projectIdList[0], $countList[1])) && p() && e('5'); // 测试获取敏捷项目下的执行数量 +r($executionTester->batchProcessNameTest($projectIdList[1], $countList[1])) && p() && e('12'); // 测试获取瀑布项目下的执行数量 +r($executionTester->batchProcessNameTest($projectIdList[2], $countList[1])) && p() && e('3'); // 测试获取看板项目下的执行数量