diff --git a/test/class/execution.class.php b/test/class/execution.class.php index d443c7e5c3..786e08f74e 100644 --- a/test/class/execution.class.php +++ b/test/class/execution.class.php @@ -15,6 +15,24 @@ class executionTest $this->productModel = $tester->loadModel('product'); } + /** + * Compute cfd of a execution. + * + * @param int|string|array $executionID + * @access public + * @return array + */ + public function computeCFDTest($executionID = 0) + { + $this->executionModel->computeCFD($executionID); + + $today = helper::today(); + return $this->executionModel->dao->select('*')->from(TABLE_CFD) + ->where('date')->eq($today) + ->beginIF(!empty($executionID))->andWhere('execution')->in($executionID)->fi() + ->fetchAll('id'); + } + /** * Get no multiple execution id. * diff --git a/test/model/execution/computecfd.php b/test/model/execution/computecfd.php new file mode 100644 index 0000000000..a02c18c767 --- /dev/null +++ b/test/model/execution/computecfd.php @@ -0,0 +1,50 @@ +#!/usr/bin/env php +gen(5); +su('admin'); + +$execution = zdTable('project'); +$execution->id->range('1-5'); +$execution->name->range('项目集1,项目1,看板1,看板2,看板3'); +$execution->type->range('program,project,,kanban{3}'); +$execution->parent->range('0,1,2{3}'); +$execution->status->range('wait{3},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); + +$kanbanCell = zdTable('kanbancell'); +$kanbanCell->id->range('1-9'); +$kanbanCell->kanban->range('3{3},4{3},5{3}'); +$kanbanCell->lane->range('1-9'); +$kanbanCell->column->range('1-9'); +$kanbanCell->type->range('task,bug,story'); +$kanbanCell->cards->range('`,1,2,3,`{3},`,4,5,`{3},6{3}'); +$kanbanCell->gen(9); + +$kanbanColumn = zdTable('kanbancolumn'); +$kanbanColumn->id->range('1-9'); +$kanbanColumn->name->range('1-9')->prefix('看板列'); +$kanbanColumn->type->range('1-9')->prefix('column'); +$kanbanColumn->gen(9); + +/** + +title=测试executionModel->computeCFD(); +cid=1 +pid=1 + +获取所有看板执行的累计卡片个数 >> 12 +获取看板1的累计流图信息 >> 3,task + +*/ + +$executionTester = new executionTest(); +$allExecutionCFDList = $executionTester->computeCFDTest(); +$singleExecutionCFDList = $executionTester->computeCFDTest(3); + +r(count($allExecutionCFDList)) && p() && e('12'); // 获取所有看板执行的累计卡片个数 +r(current($singleExecutionCFDList)) && p('execution,type') && e('3,task'); // 获取看板1的累计流图信息