* Refactor buildCFDData method and case.

This commit is contained in:
tianshujie
2023-09-08 11:03:43 +08:00
parent 0d9eae8c92
commit de9924adc3
3 changed files with 21 additions and 15 deletions
+4 -2
View File
@@ -2865,13 +2865,15 @@ class executionTest
}
/**
* 构造累计流图数据。
* Test build CFD data.
*
* @param int $executionID
* @param string $type task|story|bug
* @access public
* @return array
*/
public function buildCFDDataTest($executionID = 0)
public function buildCFDDataTest($executionID = 0, string $type = 'task'): array
{
$begin = strtotime('2022-01-12');
$end = strtotime('2022-02-12');
@@ -2879,7 +2881,7 @@ class executionTest
$dateList = array();
for($date = $begin; $date <= $end; $date += 24 * 3600) $dateList[] = date('Y-m-d', $date);
return $this->executionModel->buildCFDData($executionID, $dateList, 'task');
return $this->executionModel->buildCFDData($executionID, $dateList, $type);
}
/**
+9 -5
View File
@@ -48,9 +48,13 @@ cid=1
*/
$typeList = array('task', 'story', 'bug');
$executionTester = new executionTest();
$CFDData = $executionTester->buildCFDDataTest(3);
r(count($executionTester->buildCFDDataTest())) && p() && e('0'); // 不存在执行的累计流图信息
r(count($CFDData['line'])) && p() && e('2'); // 存在的执行的累计流图信息
r(count($executionTester->buildCFDDataTest())) && p() && e('0'); // 不存在执行的累计流图信息
r($executionTester->buildCFDDataTest(3, $typeList[0])['line']) && p('看板列4:0') && e('0'); // 存在的执行的任务卡片累计流图信息
r($executionTester->buildCFDDataTest(3, $typeList[1])['line']) && p('看板列3:0') && e('0'); // 存在的执行的需求卡片累计流图信息
r($executionTester->buildCFDDataTest(3, $typeList[2])['line']) && p('看板列2:0') && e('0'); // 存在的执行的Bug卡片累计流图信息
r(count($executionTester->buildCFDDataTest(3, $typeList[0])['line'])) && p() && e('2'); // 存在的执行的任务卡片累计流图看板列数量
r(count($executionTester->buildCFDDataTest(3, $typeList[1])['line'])) && p() && e('1'); // 存在的执行的需求卡片累计流图看板列数量
r(count($executionTester->buildCFDDataTest(3, $typeList[2])['line'])) && p() && e('2'); // 存在的执行的Bug卡片累计流图看板列数量