diff --git a/module/execution/model.php b/module/execution/model.php index d295dd85e0..c8a3345f79 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1821,49 +1821,83 @@ class executionModel extends model } /** + * 获取执行数据。 * Get execution stat data. - - * @param int $projectID - * @param string $browseType all|undone|wait|doing|suspended|closed|involved|bySearch|review - * @param int $productID - * @param int $branch - * @param bool $withTasks - * @param string|int $param skipParent - * @param string $orderBy - * @param object $pager + * + * @param int $projectID + * @param string $browseType all|undone|wait|doing|suspended|closed|involved|bySearch|review + * @param int $productID + * @param int $branch + * @param bool $withTasks + * @param string|int $param skipParent|hasParentName + * @param string $orderBy + * @param object|null $pager * @access public * @return array */ - public function getStatData($projectID = 0, $browseType = 'undone', $productID = 0, $branch = 0, $withTasks = false, $param = '', $orderBy = 'id_asc', $pager = null) + public function getStatData(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $branch = 0, bool $withTasks = false, string|int $param = '', string $orderBy = 'id_asc', object|null $pager = null): array { if(commonModel::isTutorialMode()) return $this->loadModel('tutorial')->getExecutionStats($browseType); - $productID = (int)$productID; + $executions = $this->fetchExecutionList($projectID, $browseType, $productID, (int) $param, $orderBy, $pager); + $executions = $this->batchProcessExecution($executions, $projectID, $productID, $withTasks, $param); - /* Construct the query SQL at search executions. */ - $executionQuery = ''; - if($browseType == 'bySearch') + return array_values($executions); + } + + /** + * 获取搜索执行的查询语句。 + * Get execution query SQL. + * + * @param int $queryID + * @access public + * @return string + */ + public function getExecutionQuery(int $queryID): string + { + /* Get query SQL. */ + if($queryID) { - $queryID = (int)$param; - if($queryID) + $query = $this->loadModel('search')->getQuery($queryID); + if($query) { - $query = $this->loadModel('search')->getQuery($queryID); - if($query) - { - $this->session->set('executionQuery', $query->sql); - $this->session->set('executionForm', $query->form); - } + $this->session->set('executionQuery', $query->sql); + $this->session->set('executionForm', $query->form); } - if($this->session->executionQuery === false) $this->session->set('executionQuery', ' 1 = 1'); - - $executionQuery = $this->session->executionQuery; - $allProject = "`project` = 'all'"; - - if(strpos($executionQuery, $allProject) !== false) $executionQuery = str_replace($allProject, '1', $executionQuery); - $executionQuery = preg_replace('/(`\w*`)/', 't1.$1',$executionQuery); } + if($this->session->executionQuery === false) $this->session->set('executionQuery', ' 1 = 1'); - $executions = $this->dao->select('t1.*,t2.name projectName, t2.model as projectModel')->from(TABLE_EXECUTION)->alias('t1') + $executionQuery = $this->session->executionQuery; + + /* If all projects are searched change the query SQL to 1=1. */ + $allProject = "`project` = 'all'"; + if(strpos($executionQuery, $allProject) !== false) $executionQuery = str_replace($allProject, '1', $executionQuery); + + /* Replace field. */ + $executionQuery = preg_replace('/(`\w*`)/', 't1.$1',$executionQuery); + + return $executionQuery; + } + + /** + * 获取执行列表信息。 + * Get execution list information. + * + * @param int $projectID + * @param string $browseType all|undone|wait|doing|suspended|closed|involved|bySearch|review + * @param int $productID + * @param string $orderBy + * @param int $param + * @param object|null $pager + * @access public + * @return array + */ + public function fetchExecutionList(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $param = 0, string $orderBy = 'id_asc', object|null $pager = null): array + { + /* Construct the query SQL at search executions. */ + $executionQuery = $browseType == 'bySearch' ? $this->getExecutionQuery($param) : ''; + + return $this->dao->select('t1.*,t2.name projectName, t2.model as projectModel')->from(TABLE_EXECUTION)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') ->beginIF($productID)->leftJoin(TABLE_PROJECTPRODUCT)->alias('t3')->on('t1.id=t3.project')->fi() ->where('t1.type')->in('sprint,stage,kanban') @@ -1883,63 +1917,57 @@ class executionModel extends model ->orderBy($orderBy) ->page($pager, 't1.id') ->fetchAll('id'); + } - if(empty($productID) and !empty($executions)) $projectProductIdList = $this->dao->select('project, GROUP_CONCAT(product) as product')->from(TABLE_PROJECTPRODUCT)->where('project')->in(array_keys($executions))->groupBy('project')->fetchPairs(); + /** + * 批量处理执行数据。 + * Batch process execution data. + * + * @param array $executions + * @param int $projectID + * @param int $productID + * @param bool $withTasks + * @param string|int $param skipParent|hasParentName + * @access public + * @return array + */ + public function batchProcessExecution(array $executions, int $projectID = 0, int $productID = 0, bool $withTasks = false, string|int $param = ''): array + { + if(empty($executions)) return $executions; - $hours = $this->loadModel('project')->computerProgress($executions); - $burns = $this->getBurnData($executions); - - /* Get the number of execution teams. */ - $teams = $this->dao->select('t1.root,count(t1.id) as teams')->from(TABLE_TEAM)->alias('t1') - ->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account') - ->where('t1.root')->in(array_keys($executions)) - ->andWhere('t1.type')->ne('project') - ->andWhere('t2.deleted')->eq(0) - ->groupBy('t1.root') - ->fetchAll('root'); - - $productNameList = $this->dao->select('t1.id,GROUP_CONCAT(t3.`name`) as productName')->from(TABLE_EXECUTION)->alias('t1') - ->leftjoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project') - ->leftjoin(TABLE_PRODUCT)->alias('t3')->on('t2.product=t3.id') - ->where('t1.project')->eq($projectID) - ->andWhere('t1.type')->in('kanban,sprint,stage') - ->groupBy('t1.id') - ->fetchPairs(); + $memberGroup = $this->executionTao->getMemberCountGroup(array_keys($executions)); // Get execution team member count. + $productList = $this->executionTao->getProductList($projectID); // Get product name of the linked execution. if($withTasks) $executionTasks = $this->getTaskGroupByExecution(array_keys($executions)); - /* Process executions. */ - $this->app->loadConfig('task'); - + $parentList = array(); $emptyHour = array('totalEstimate' => 0, 'totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0); $today = helper::today(); - $parentList = array(); + $hours = $this->loadModel('project')->computerProgress($executions); + $burns = $this->getBurnData($executions); foreach($executions as $execution) { - $execution->productName = isset($productNameList[$execution->id]) ? $productNameList[$execution->id] : ''; + $execution->productName = isset($productList[$execution->id]) ? $productList[$execution->id]->productName : ''; + $execution->end = date(DT_DATE1, strtotime($execution->end)); + $execution->hours = isset($hours[$execution->id]) ? $hours[$execution->id] : (object)$emptyHour; + $execution->teamCount = isset($memberGroup[$execution->id]) ? $memberGroup[$execution->id]->teams : 0; - /* Process the end time. */ - $execution->end = date(DT_DATE1, strtotime($execution->end)); + if(isset($executions[$execution->parent])) $executions[$execution->parent]->isParent = 1; + if(empty($productID) && !empty($productList[$execution->id])) $execution->product = $productList[$execution->id]->product; /* Judge whether the execution is delayed. */ - if($execution->status != 'done' and $execution->status != 'closed' and $execution->status != 'suspended') + if($execution->status != 'done' && $execution->status != 'closed' && $execution->status != 'suspended') { $delay = helper::diffDate($today, $execution->end); if($delay > 0) $execution->delay = $delay; } - if(isset($executions[$execution->parent])) $executions[$execution->parent]->isParent = 1; - /* Process the burns. */ $execution->burns = array(); $burnData = isset($burns[$execution->id]) ? $burns[$execution->id] : array(); foreach($burnData as $data) $execution->burns[] = $data->value; - /* Process the hours. */ - $execution->hours = isset($hours[$execution->id]) ? $hours[$execution->id] : (object)$emptyHour; - $execution->teamCount = isset($teams[$execution->id]) ? $teams[$execution->id]->teams : 0; - - if(isset($executionTasks) and isset($executionTasks[$execution->id])) $execution->tasks = $executionTasks[$execution->id]; + if(isset($executionTasks) && isset($executionTasks[$execution->id])) $execution->tasks = $executionTasks[$execution->id]; /* In the case of the waterfall model, calculate the sub-stage. */ if($param === 'skipParent') @@ -1952,15 +1980,8 @@ class executionModel extends model $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); $executions[$execution->id]->title = implode('/', $parentExecutions); } - - /* Bind execution product */ - if(!empty($projectProductIdList) and !empty($projectProductIdList[$execution->id])) - { - $execution->product = $projectProductIdList[$execution->id]; - } } - - return array_values($executions); + return $executions; } /** diff --git a/module/execution/tao.php b/module/execution/tao.php index 6939bec107..e543a4eb45 100644 --- a/module/execution/tao.php +++ b/module/execution/tao.php @@ -24,4 +24,41 @@ class executionTao extends executionModel $this->session->set('execution', $executionID, $this->app->tab); $this->setProjectSession($executionID); } + + /** + * 获取执行团队成员数量。 + * Get execution team member count. + * + * @param array $executionIdList + * @access protected + * @return void + */ + protected function getMemberCountGroup(array $executionIdList): array + { + return $this->dao->select('t1.root,count(t1.id) as teams')->from(TABLE_TEAM)->alias('t1') + ->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account') + ->where('t1.root')->in($executionIdList) + ->andWhere('t1.type')->ne('project') + ->andWhere('t2.deleted')->eq(0) + ->groupBy('t1.root') + ->fetchAll('root'); + } + + /** + * 获取执行关联的产品信息。 + * Get product information of the linked execution. + * + * @param int $projectID + * @access protected + * @return array + */ + protected function getProductList(int $projectID): array + { + return $this->dao->select('t1.id,GROUP_CONCAT(product) as product,GROUP_CONCAT(t3.`name`) as productName')->from(TABLE_EXECUTION)->alias('t1') + ->leftjoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project') + ->leftjoin(TABLE_PRODUCT)->alias('t3')->on('t2.product=t3.id') + ->where('t1.project')->eq($projectID) + ->andWhere('t1.type')->in('kanban,sprint,stage') + ->fetchAll('id'); + } } diff --git a/module/execution/test/execution.class.php b/module/execution/test/execution.class.php index bc2a3646d0..a4d3de416d 100644 --- a/module/execution/test/execution.class.php +++ b/module/execution/test/execution.class.php @@ -1874,7 +1874,7 @@ class executionTest * @access public * @return array */ - public function fixFirstTest($executionID, $param = array(), $date) + public function fixFirstTest($executionID, $param = array(), $date = '') { global $tester; @@ -2992,4 +2992,19 @@ class executionTest $extendFields = $this->executionModel->getExtendFields($moduleName); return $extendFields; } + + /** + * 获取搜索执行的查询语句。 + * Get execution query SQL. + * + * @param int $queryID + * @access public + * @return string + */ + public function getExecutionQueryTest(int $queryID): string + { + if(!$queryID) $this->executionModel->session->set('executionQuery', "(( `project` = 'all' ) AND ( 1 AND `status` = 'doing'))"); + + return $this->executionModel->getExecutionQuery($queryID); + } } diff --git a/module/execution/test/model/batchprocessexecution.php b/module/execution/test/model/batchprocessexecution.php new file mode 100755 index 0000000000..99687c2b8f --- /dev/null +++ b/module/execution/test/model/batchprocessexecution.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +gen(5); +su('admin'); + +zdTable('project')->config('execution', true)->gen(30); +zdTable('product')->config('product', true)->gen(30); +zdTable('projectproduct')->config('projectproduct', true)->gen(60); + +/** + +title=测试 executionModel->batchProcessExecution(); +timeout=0 +cid=1 + +*/ + +global $tester; +$executionModel = $tester->loadModel('execution'); + +$executions = $executionModel->fetchExecutionList(60, 'undone'); +$projectID = 60; +$productID = 5; +$paramList = array('skipParent', 'hasParentName'); + +r($executionModel->batchProcessExecution(array())) && p() && e('0'); // 测试空数据 +r($executionModel->batchProcessExecution($executions)) && p('117:name') && e('阶段21'); // 测试处理执行 +r($executionModel->batchProcessExecution($executions, $projectID)) && p('117:name') && e('阶段21'); // 测试处理瀑布项目2的执行 +r($executionModel->batchProcessExecution($executions, $projectID, $productID, true)) && p('117:name') && e('阶段21'); // 测试处理产品下的执行下 +r($executionModel->batchProcessExecution($executions, $projectID, 0 , true)) && p('117:name') && e('阶段21'); // 测试处理执行下的任务 +r($executionModel->batchProcessExecution($executions, $projectID, 0 , true, $paramList[0])) && p('117:name') && e('瀑布项目2 / 阶段21'); // 测试去掉执行中的父阶段 +r($executionModel->batchProcessExecution($executions, $projectID, 0 , true, $paramList[1])) && p('117:name') && e('瀑布项目2 / 阶段21'); // 处理执行中的父阶段的名称 +r($executionModel->batchProcessExecution($executions, $projectID, $productID, true)) && p('117:name') && e('瀑布项目2 / 阶段21'); // 测试处理执行下的任务 +r($executionModel->batchProcessExecution($executions, $projectID, $productID, true, $paramList[0])) && p('117:name') && e('瀑布项目2 / 瀑布项目2 / 阶段21'); // 测试去掉执行中的父阶段 +r($executionModel->batchProcessExecution($executions, $projectID, $productID, true, $paramList[1])) && p('117:name') && e('瀑布项目2 / 瀑布项目2 / 阶段21'); // 处理执行中的父阶段的名称 diff --git a/module/execution/test/model/fetchexecutionlist.php b/module/execution/test/model/fetchexecutionlist.php new file mode 100755 index 0000000000..d29d273084 --- /dev/null +++ b/module/execution/test/model/fetchexecutionlist.php @@ -0,0 +1,69 @@ +#!/usr/bin/env php +gen(5); +su('admin'); + +zdTable('project')->config('execution', true)->gen(30); +zdTable('product')->config('product', true)->gen(30); +zdTable('projectproduct')->config('projectproduct', true)->gen(60); + +$userquery = zdTable('userquery'); +$userquery->id->range(1); +$userquery->account->range('admin'); +$userquery->module->range('execution'); +$userquery->title->range('搜索进行中的迭代'); +$userquery->sql->range("`(( 1 AND `status` = 'doing' ))`"); +$userquery->form->range('``'); +$userquery->gen(1); + +/** + +title=测试 executionModel->fetchExecutionList(); +timeout=0 +cid=1 + +*/ + +$projectIdList = array(0, 11); +$browseTypeList = array('all', 'undone', 'wait', 'doing', 'suspended', 'closed', 'involved', 'bySearch'); +$productIdList = array(0, 5); +$paramList = array(0, 1); +$orderByList = array('id_asc', 'begin_desc'); + +global $tester; +$executionModel = $tester->loadModel('execution'); + +$allExecutions = $executionModel->fetchExecutionList(); +$searchExecutions = $executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[7], $productIdList[0], $paramList[1], $orderByList[0]); +$projectExecutions = $executionModel->fetchExecutionList($projectIdList[1]); +$allStatusExecutions = $executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[0]); +$undoneStatusExecutions = $executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[1]); +$waitStatusExecutions = $executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[2]); +$doingStatusExecutions = $executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[3]); +$suspendedStatusExecutions = $executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[4]); +$closedStatusExecutions = $executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[5]); +$involvedExecutions = $executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[6]); +$productExecutions = $executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[1], $productIdList[1]); + +r(count($allExecutions)) && p() && e('20'); // 获取没有限制条件时执行的个数 +r(count($searchExecutions)) && p() && e('11'); // 获取进行中执行的个数 +r(count($projectExecutions)) && p() && e('3'); // 获取敏捷项目1下的执行的个数 +r(count($allStatusExecutions)) && p() && e('24'); // 获取全部状态执行的个数 +r(count($undoneStatusExecutions)) && p() && e('20'); // 获取未关闭的执行的个数 +r(count($waitStatusExecutions)) && p() && e('6'); // 获取未开始的执行的个数 +r(count($doingStatusExecutions)) && p() && e('11'); // 获取进行中的执行的个数 +r(count($suspendedStatusExecutions)) && p() && e('3'); // 获取已暂停的执行的个数 +r(count($closedStatusExecutions)) && p() && e('4'); // 获取已关闭的执行的个数 +r(count($involvedExecutions)) && p() && e('24'); // 获取我参与的执行的个数 +r(count($productExecutions)) && p() && e('1'); // 获取关联产品5的执行的个数 + +r($executionModel->fetchExecutionList($projectIdList[1], $browseTypeList[0], $productIdList[0], $paramList[0], $orderByList[0])) && p('101:project,name') && e('11,迭代5'); // 获取敏捷项目下全部的执行 +r($executionModel->fetchExecutionList($projectIdList[1], $browseTypeList[1], $productIdList[0], $paramList[0], $orderByList[0])) && p('101:project,name') && e('11,迭代5'); // 获取敏捷项目下未关闭的执行 +r($executionModel->fetchExecutionList($projectIdList[1], $browseTypeList[2], $productIdList[0], $paramList[0], $orderByList[0])) && p('101:project,name') && e('11,迭代5'); // 获取敏捷项目下未开始的执行 +r($executionModel->fetchExecutionList($projectIdList[1], $browseTypeList[3], $productIdList[0], $paramList[0], $orderByList[0])) && p('103:project,name') && e('11,迭代7'); // 获取敏捷项目下进行中的执行 +r($executionModel->fetchExecutionList($projectIdList[1], $browseTypeList[4], $productIdList[0], $paramList[0], $orderByList[0])) && p() && e('0'); // 获取敏捷项目下已暂停的执行 +r($executionModel->fetchExecutionList($projectIdList[1], $browseTypeList[5], $productIdList[0], $paramList[0], $orderByList[0])) && p() && e('0'); // 获取敏捷项目下已关闭的执行 +r($executionModel->fetchExecutionList($projectIdList[1], $browseTypeList[6], $productIdList[0], $paramList[0], $orderByList[0])) && p('103:project,name') && e('11,迭代7'); // 获取敏捷项目下我参与的执行 +r($executionModel->fetchExecutionList($projectIdList[1], $browseTypeList[0], $productIdList[0], $paramList[0], $orderByList[1])) && p('103:project,name') && e('11,迭代7'); // 获取敏捷项目下按照开始日期倒序排列全部的执行 +r($executionModel->fetchExecutionList($projectIdList[0], $browseTypeList[1], $productIdList[0], $paramList[0], $orderByList[1])) && p('126:project,name') && e('100,看板30'); // 获取按照开始日期倒序排列执行 diff --git a/module/execution/test/model/getexecutionquery.php b/module/execution/test/model/getexecutionquery.php new file mode 100755 index 0000000000..349c0cb285 --- /dev/null +++ b/module/execution/test/model/getexecutionquery.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +gen(5); +su('admin'); + +$userquery = zdTable('userquery'); +$userquery->id->range(1); +$userquery->account->range('admin'); +$userquery->module->range('execution'); +$userquery->title->range('搜索进行中的迭代'); +$userquery->sql->range("`(( 1 AND `name` LIKE '迭代' ) AND ( 1 AND `status` = 'doing' ))`"); +$userquery->form->range('``'); +$userquery->gen(1); + +/** + +title=测试 executionModel->getExecutionQuery(); +timeout=0 +cid=1 + +*/ + +$queryIdList = array(0, 1); +$executionTester = new executionTest(); +r($executionTester->getExecutionQueryTest($queryIdList[0])) && p() && e("(( 1 ) AND ( 1 AND t1.`status` = 'doing'))"); // 没有queryID时,获取查询执行的SQL +r($executionTester->getExecutionQueryTest($queryIdList[1])) && p() && e("(( 1 AND t1.`name` LIKE '迭代' ) AND ( 1 AND t1.`status` = 'doing' ))"); // 有queryID时,获取查询执行的SQL diff --git a/module/execution/test/model/getstatdata.php b/module/execution/test/model/getstatdata.php index 6a153f75ec..d59049a596 100755 --- a/module/execution/test/model/getstatdata.php +++ b/module/execution/test/model/getstatdata.php @@ -55,35 +55,8 @@ su('admin'); /** title=测试 executionModel->getStatData(); +timeout=0 cid=1 -pid=1 - -测试默认值 >> 3 -测试传入空值 >> 3 -测试projectID为10的所有未关闭执行 >> 0 -测试projectID为10的所有执行 >> 0 -测试projectID为10的未开始执行 >> 0 -测试projectID为10的进行中执行 >> 0 -测试projectID为10的已挂起执行 >> 0 -测试projectID为10的已关闭执行 >> 0 -测试projectID为10的我参与执行 >> 0 -测试projectID为10的搜索出来的执行 >> 0 -测试projectID为10的评审执行 >> 0 -测试projectID为10, productID为1, branchID为0的所有执行 >> 0 -测试projectID为10, productID为1, branchID为0的所有执行和任务 >> 0 -测试projectID为10, productID为1, branchID为0的非父阶段 >> 0 -测试projectID为2的所有未关闭执行 >> 1 -测试projectID为2的所有执行 >> 1 -测试projectID为2的未开始执行 >> 1 -测试projectID为2的进行中执行 >> 1 -测试projectID为2的已挂起执行 >> 1 -测试projectID为2的已关闭执行 >> 1 -测试projectID为2的我参与执行 >> 1 -测试projectID为2的搜索出来的执行 >> 1 -测试projectID为2的评审执行 >> 1 -测试projectID为2, productID为1, branchID为0的所有执行 >> 1 -测试projectID为2, productID为1, branchID为0的所有执行和任务 >> 1 -测试projectID为2, productID为1, branchID为0的非父阶段 >> 1 */ diff --git a/module/execution/test/tao/getmembercountgroup.php b/module/execution/test/tao/getmembercountgroup.php new file mode 100755 index 0000000000..2cb675e7b9 --- /dev/null +++ b/module/execution/test/tao/getmembercountgroup.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +gen(200); +su('admin'); + +zdTable('project')->config('execution', true)->gen(30); +zdTable('team')->config('team', true)->gen(60); + +/** + +title=测试 executionModel->getMemberCountGroup(); +timeout=0 +cid=1 + +*/ + +global $tester; +$executionModel = $tester->loadModel('execution'); + +r($executionModel->getMemberCountGroup(array())) && p() && e('0'); // 测试空数据 +r(count($executionModel->getMemberCountGroup(array(101,102,103,104,105)))) && p() && e('5'); // 测试获取执行的团队成员分组个数 +r($executionModel->getMemberCountGroup(array(101,102,103,104,105))) && p('101:root,teams') && e('101,1'); // 测试获取执行的团队成员个数 +r($executionModel->getMemberCountGroup(array(11))) && p() && e('0'); // 测试获取项目团队成员 diff --git a/module/execution/test/tao/getproductlist.php b/module/execution/test/tao/getproductlist.php new file mode 100755 index 0000000000..81e7c81310 --- /dev/null +++ b/module/execution/test/tao/getproductlist.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +gen(200); +su('admin'); + +zdTable('project')->config('execution', true)->gen(30); +zdTable('product')->config('product', true)->gen(30); +zdTable('projectproduct')->config('projectproduct', true)->gen(60); + +/** + +title=测试 executionModel->getProductList(); +timeout=0 +cid=1 + +*/ + +global $tester; +$executionModel = $tester->loadModel('execution'); + +r(count($executionModel->getProductList(11))) && p() && e('1'); // 测试获取敏捷项目下执行的产品个数 +r(current($executionModel->getProductList(11))) && p('id') && e('101'); // 测试获取敏捷项目下执行的产品 diff --git a/module/execution/test/yaml/execution.yaml b/module/execution/test/yaml/execution.yaml new file mode 100644 index 0000000000..7f0d4b4b64 --- /dev/null +++ b/module/execution/test/yaml/execution.yaml @@ -0,0 +1,63 @@ +title: execution. +desc: execution data. +author: Wang Yidong +version: "1.0" +fields: + - field: id + range: 11,60,61,100,101-700 + - field: name + note: "名称" + fields: + - field: name1 + range: 敏捷项目,瀑布项目{2},看板项目,迭代{5},阶段{18},看板{5} + - field: name2 + range: 1-10000 + - field: project + range: 0{4},11{5},60{12},61{6},100{5} + - field: model + range: scrum,waterfall{2},kanban,[]{28} + - field: attribute + range: "[]{4},[]{5},request,design,dev,qa,release,review,request,design,dev,qa,release,review,request,design,dev,qa,release,review,[]{5}" + - field: type + range: project{4},sprint{5},stage{18},kanban{5} + - field: budget + range: 800000-1:100 + - field: status + range: doing{4},wait{2},doing{2},suspended{2},closed{2} + - field: auth + range: "extend" + - field: desc + range: 1-10000 + prefix: "迭代描述" + - field: begin + range: "(-2M)-(+M):1D" + type: timestamp + format: "YY/MM/DD" + postfix: "\t" + - field: end + range: "(+1w)-(+2M):1D" + type: timestamp + format: "YY/MM/DD" + postfix: "\t" + - field: grade + range: 1{4},1{5},1{6},2{6},1{6},1{5} + - field: parent + range: 0{4},11{5},60{6},106-111,61{6},100{5} + - field: path + fields: + - field: path1 + prefix: "," + range: 11,60,61,100,11{5},60{12},61{6},100{5} + - field: path2 + prefix: "," + range: "[]{4},101-105,106-111,106-111,118-700" + postfix: "," + - field: path3 + range: "[]{4},[]{5},[]{6},112-117,[]{50}" + postfix: "," + - field: acl + range: open{4},private{4} + - field: multiple + range: 1{4},1{3},0{2},1{18},1{5} + - field: deleted + range: 0{30},1 diff --git a/module/execution/test/yaml/product.yaml b/module/execution/test/yaml/product.yaml new file mode 100644 index 0000000000..f9e475807c --- /dev/null +++ b/module/execution/test/yaml/product.yaml @@ -0,0 +1,18 @@ +title: product data +author: zhouxin +version: 1.0.0 + +fields: + - field: id + range: 1-30 + - field: name + range: 1-30 + prefix: '产品' + - field: program + range: 1 + - field: line + range: 1{10},2{10},3{10} + - field: status + range: 'normal{20},closed{10}' + - field: PO + range: 'admin{10},user1{10},user2{10}' diff --git a/module/execution/test/yaml/projectproduct.yaml b/module/execution/test/yaml/projectproduct.yaml new file mode 100644 index 0000000000..e8fb915dcf --- /dev/null +++ b/module/execution/test/yaml/projectproduct.yaml @@ -0,0 +1,13 @@ +title: projectproduct data +author: Shujie Tian +version: 1.0.0 + +fields: + - field: project + range: 11,60,61,100,101-700 + - field: product + range: 1-30 + - field: branch + range: 0 + - field: plan + range: 0 diff --git a/module/execution/test/yaml/team.yaml b/module/execution/test/yaml/team.yaml new file mode 100644 index 0000000000..2173922d72 --- /dev/null +++ b/module/execution/test/yaml/team.yaml @@ -0,0 +1,20 @@ +title: team data. +author: Shujie Tian +version: "1.0" +fields: + - field: id + range: 1-100 + - field: root + range: 11,60,61,100,101-700 + - field: type + range: project{4},execution{96} + - field: account + fields: + - field: account1 + range: admin,user{10},test{10},dev{10} + - field: account2 + range: "[],1-10,1-10,1-10" + - field: role + range: 管理员,产品{10},测试{10},研发{10} + - field: limited + range: 'no'