From e7c0a2f18b36bae51c9aa9d2136f3d469b44eeee Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 23 Dec 2024 14:58:38 +0800 Subject: [PATCH] * [ci,done,0.5h] modify gettaskgroupbyexecution unit test. --- .../test/lib/execution.unittest.class.php | 9 +++++---- .../test/model/gettaskgroupbyexecution.php | 14 +++++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/module/execution/test/lib/execution.unittest.class.php b/module/execution/test/lib/execution.unittest.class.php index 5c680c4a3d..f51ca3bf8a 100644 --- a/module/execution/test/lib/execution.unittest.class.php +++ b/module/execution/test/lib/execution.unittest.class.php @@ -963,14 +963,15 @@ class executionTest /** * Get the task data group by execution id list. * - * @param array $executionIdList + * @param array $executionIdList + * @param bool $showCount * @access public - * @return int + * @return int|array */ - public function getTaskGroupByExecutionTest($executionIdList = array()) + public function getTaskGroupByExecutionTest($executionIdList = array(), $showCount = true) { $objects = $this->executionModel->getTaskGroupByExecution($executionIdList); - return count($objects); + return $showCount ? count($objects) : $objects; } /** diff --git a/module/execution/test/model/gettaskgroupbyexecution.php b/module/execution/test/model/gettaskgroupbyexecution.php index 6dc185a944..af6dc048f4 100755 --- a/module/execution/test/model/gettaskgroupbyexecution.php +++ b/module/execution/test/model/gettaskgroupbyexecution.php @@ -25,8 +25,16 @@ $task->status->range('wait,doing'); $task->estimate->range('1-10'); $task->left->range('1-10'); $task->consumed->range('1-10'); +$task->story->range('1-10'); +$task->storyVersion->range('1{6},2{4}'); $task->gen(10); +$story = zenData('story'); +$story->id->range('1-10'); +$story->status->range('active,changed'); +$story->version->range('1{6},2{2},3{2}'); +$story->gen(10); + su('admin'); /** @@ -41,6 +49,10 @@ cid=1 $executionIdList = array(0, 3, 4, 5); $execution = new executionTest(); - r($execution->getTaskGroupByExecutionTest()) && p() && e('0'); // 测试空数据 r($execution->getTaskGroupByExecutionTest($executionIdList)) && p() && e('3'); // 测试获取执行的任务 + +$taskGroup = $execution->getTaskGroupByExecutionTest($executionIdList, false); +r($taskGroup[3]) && p('1:storyVersion,storyStatus,needConfirm') && e('1,active,~~'); // 测试获取执行ID=3的任务关联需求版本跟需求状态 +r($taskGroup[4]) && p('2:storyVersion,storyStatus,needConfirm') && e('1,~~,~~'); // 测试获取执行ID=4的任务关联需求版本跟需求状态 +r($taskGroup[5]) && p('9:storyVersion,storyStatus,needConfirm') && e('2,active,1'); // 测试获取执行ID=5的任务关联需求版本跟需求状态