diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 222f92be77..071c0b7b99 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -1930,7 +1930,7 @@ 23560 项目-测试用例列表有报错 2022-06-02 17.0 -修复的bug +修复的Bug 22948 执行需求列表中列名称显示遮挡 22898 项目关闭导致该项目下执行所属项目自动变更了 22904 导入测试用例模板没有区分必填项 diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index 4097340be8..99019f724a 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -83,41 +83,14 @@ if($this->app->tab == 'project') js::set('objectID', $projectID); -
| dev->params?> | diff --git a/module/execution/control.php b/module/execution/control.php index 92a51ab52a..544207a2b5 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1531,8 +1531,6 @@ class execution extends control } $dateList = date::getDateList($begin, $end, 'Y-m-d', $withWeekend == 'false'? 'noweekend' : ''); - //list($cycleTimeAvg, $throughput) = $this->execution->getCFDStatistics($executionID, $dateList, $type); - $chartData = $this->execution->buildCFDData($executionID, $dateList, $type); if(isset($chartData['line'])) $chartData['line'] = array_reverse($chartData['line']); diff --git a/module/execution/model.php b/module/execution/model.php index e8da15ea9c..4e7f718631 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2283,7 +2283,7 @@ class executionModel extends model $productType = 'normal'; $productNum = count($products); $productPairs = array(0 => ''); - $branches = $this->loadModel('project')->getBranchesByProject($execution->id); + $branches = empty($execution) ? array() : $this->loadModel('project')->getBranchesByProject($execution->id); foreach($products as $product) { @@ -3763,44 +3763,6 @@ class executionModel extends model return $data; } - /** - * Get CFD statistics. - * - * @param int $executionID - * @param array $dateList - * @param string $type - * @access public - * @return void - */ - public function getCFDStatistics($executionID, $dateList, $type) - { - $kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $type); - $kanbanData = array_shift($kanbanData); - - $cycleTime = array(); - foreach($kanbanData->groups as $group) - { - foreach($group->lanes as $lane) - { - if(!isset($lane->items['closed'])) continue; - - foreach($lane->items['closed'] as $item) - { - $diffTime = $type == 'story' ? strtotime($item['lastEditedDate']) - strtotime($item['openedDate']) : strtotime($item['closedDate']) - strtotime($item['openedDate']); - $day = round($diffTime / (3600 * 24), 1); - if($day > 0) $cycleTime[$item['id']] = $day; - } - } - } - - $itemCount = count($cycleTime); - if(!$itemCount) return array('', ''); - $cycleTimeAvg = round(array_sum($cycleTime) / $itemCount, 1); - $throughput = round(($itemCount * 7) / $cycleTimeAvg, 1) . "{$this->lang->execution->kanbanCardsUnit}/" . $this->lang->execution->week; - - return array($cycleTimeAvg, $throughput); - } - /** * Get taskes by search. * diff --git a/module/execution/view/testcase.html.php b/module/execution/view/testcase.html.php index b33242d9bd..d965862231 100644 --- a/module/execution/view/testcase.html.php +++ b/module/execution/view/testcase.html.php @@ -72,7 +72,8 @@ version";?> task";?> -createLink('testcase', 'view', $params, '', '', $case->project), $case->title, null, "style='color: $case->color' data-app='{$this->app->tab}'");?> | + auto == 'auto' ? " " : '';?> +createLink('testcase', 'view', $params, '', '', $case->project), $case->title . $autoIcon, null, "style='color: $case->color' data-app='{$this->app->tab}'");?> | pri?>' title='testcase->priList, $case->pri, $case->pri);?>'>testcase->priList, $case->pri, $case->pri)?> | testcase->typeList, $case->type);?> | diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index f6440c871c..258ba79616 100755 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -357,7 +357,12 @@ js::set('vision', $this->config->vision); |
|---|---|---|---|---|---|
|
diff --git a/module/testcase/css/browse.css b/module/testcase/css/browse.css
index 4062f4a723..3695c8e51c 100644
--- a/module/testcase/css/browse.css
+++ b/module/testcase/css/browse.css
@@ -6,7 +6,7 @@ body {margin-bottom: 25px;}
#caseForm table tbody tr td {overflow: hidden; white-space: nowrap;}
#caseForm .setting {height: 25px;}
#caseForm table tbody .c-name {overflow: hidden; padding-right: 65px;}
-#caseForm table tbody .c-name a:first-child {overflow: hidden; display: inline-block; width: 100%;}
+#caseForm table tbody .c-name a:first-child {overflow: hidden; display: inline-block; max-width: 100%;}
.dropdown-menu.with-search {padding: 0; min-width: 150px; overflow: hidden; max-height: 302px;}
.dropdown-menu > .menu-search .input-group {width: 100%;}
diff --git a/module/testcase/model.php b/module/testcase/model.php
index 3c5d34e0c3..8dc0912ad0 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -2106,7 +2106,12 @@ class testcaseModel extends model
$autoIcon = $case->auto == 'auto' ? " " : '';
if(isset($branches[$case->branch]) and $showBranch) echo "{$branches[$case->branch]} ";
if($modulePairs and $case->module and isset($modulePairs[$case->module])) echo "{$modulePairs[$case->module]} ";
- echo $canView ? ($fromCaseID ? html::a($caseLink, $case->title, null, "style='color: $case->color' data-app='{$this->app->tab}'") . html::a(helper::createLink('testcase', 'view', "caseID=$fromCaseID"), "[#$fromCaseID]" . $autoIcon, '', "data-app='{$this->app->tab}'") : html::a($caseLink, $case->title . $autoIcon, null, "style='color: $case->color' data-app='{$this->app->tab}'")) : "$case->title";
+ echo $canView ? html::a($caseLink, $case->title, null, "style='color: $case->color' data-app='{$this->app->tab}'")
+ : "$case->title";
+
+ $fromLink = ($fromCaseID and $canView) ? helper::createLink('testcase', 'view', "caseID=$fromCaseID") : '#';
+ $title = $fromCaseID ? "[#$fromCaseID]$autoIcon" : $autoIcon;
+ if($case->auto == 'auto') echo html::a($fromLink, $title, '', "data-app='{$this->app->tab}'");
break;
case 'branch':
echo $branches[$case->branch];
diff --git a/module/user/model.php b/module/user/model.php
index d1724b9605..48cc74befe 100644
--- a/module/user/model.php
+++ b/module/user/model.php
@@ -862,7 +862,7 @@ class userModel extends model
$_POST['password1'] = trim($_POST['password1']);
$_POST['password2'] = trim($_POST['password2']);
if(!$canNoPassword and empty($_POST['password1'])) dao::$errors['password1'][] = sprintf($this->lang->error->notempty, $this->lang->user->password) . ' '; - if($this->post->password1 != false) + if(!$canNoPassword and $this->post->password1 != false) { if(isset($this->config->safe->mode) and ($this->post->passwordStrength < $this->config->safe->mode)) dao::$errors['password1'][] = zget($this->lang->user->placeholder->passwordStrengthCheck, $this->config->safe->mode, $this->lang->user->weakPassword) . ' '; diff --git a/module/zahost/js/browse.js b/module/zahost/js/browse.js index 5ce8f99b34..1f982a56c5 100644 --- a/module/zahost/js/browse.js +++ b/module/zahost/js/browse.js @@ -6,12 +6,14 @@ $('#hostList tr[data-status="wait"]').hover(function(){ if(showFeature) { - $.apps.close('help'); - $.apps.open('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao', 'help'); + var encodedHelpPageUrl = encodeURIComponent('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao'); + var urlForNewTab = window.location.origin + '#app=help&url=' + encodedHelpPageUrl; + window.open(urlForNewTab) } $('#helpTab').click(function() { - $.apps.close('help'); - $.apps.open('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao', 'help'); + var encodedHelpPageUrl = encodeURIComponent('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao'); + var urlForNewTab = window.location.origin + '#app=help&url=' + encodedHelpPageUrl; + window.open(urlForNewTab) }) diff --git a/module/zanode/control.php b/module/zanode/control.php index e2866dbdc4..54de57f57e 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -73,7 +73,6 @@ class zanode extends control */ public function list($hostID, $orderBy = 'id_desc') { - $this->view->title = $this->lang->zanode->common; $this->view->nodeList = $this->loadModel("zanode")->getListByHost($hostID, $orderBy); $this->view->orderBy = $orderBy; @@ -292,14 +291,14 @@ class zanode extends control $error = $this->zanode->destroy($nodeID); - if($error) + if(!empty($error)) { return print(js::alert($error)); } else { if(isonlybody()) return print(js::alert($this->lang->zanode->actionSuccess) . js::reload('parent.parent')); - return print(js::alert($this->lang->zanode->actionSuccess) . js::reload('parent')); + return print(js::alert($this->lang->zanode->actionSuccess) . js::locate($this->createLink('zanode', 'browse'), 'parent')); } } diff --git a/module/zanode/js/browse.js b/module/zanode/js/browse.js index 882c7a4cc0..2eaf684353 100644 --- a/module/zanode/js/browse.js +++ b/module/zanode/js/browse.js @@ -1,11 +1,13 @@ if(showFeature) { - $.apps.close('help'); - $.apps.open('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao', 'help'); + var encodedHelpPageUrl = encodeURIComponent('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao'); + var urlForNewTab = window.location.origin + '#app=help&url=' + encodedHelpPageUrl; + window.open(urlForNewTab) } $('#helpTab').click(function() { - $.apps.close('help'); - $.apps.open('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao', 'help'); + var encodedHelpPageUrl = encodeURIComponent('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao'); + var urlForNewTab = window.location.origin + '#app=help&url=' + encodedHelpPageUrl; + window.open(urlForNewTab) }) diff --git a/module/zanode/js/view.js b/module/zanode/js/view.js index 82ff7e8a62..c2a562506b 100644 --- a/module/zanode/js/view.js +++ b/module/zanode/js/view.js @@ -47,7 +47,7 @@ function checkServiceStatus(){ } else if(key == "node") { - if(nodeStatus != resultData.data[key]) + if(nodeStatus != resultData.data[key] && resultData.data[key]) { window.location.reload(); } diff --git a/module/zanode/model.php b/module/zanode/model.php index 591d14fed0..af034bfdfa 100644 --- a/module/zanode/model.php +++ b/module/zanode/model.php @@ -212,11 +212,10 @@ class zanodemodel extends model public function destroy($id) { $node = $this->getNodeByID($id); - - $req = array( 'name' => $node->name ); - + if($node) { + $req = array( 'name' => $node->name ); $agnetUrl = 'http://' . $node->ip . ':' . $node->hzap; $result = commonModel::http($agnetUrl . '/api/v1/kvm/remove', json_encode($req), array(), array("Authorization:$node->tokenSN")); diff --git a/module/zanode/view/list.html.php b/module/zanode/view/list.html.php index b065f6a17a..084e62a41a 100644 --- a/module/zanode/view/list.html.php +++ b/module/zanode/view/list.html.php @@ -36,7 +36,7 @@ | |||||
| inlink('view', "id=$node->id"), $node->name, '', ""); ?> | +inlink('view', "id=$node->id"), $node->name, '_blank', ""); ?> | zanode->os->cpuCores, $node->cpuCores); ?> | memory . $this->lang->zahost->unitList['GB']; ?> | diskSize . $this->lang->zahost->unitList['GB']; ?> | diff --git a/test/class/execution.class.php b/test/class/execution.class.php index d928435be8..205a472642 100644 --- a/test/class/execution.class.php +++ b/test/class/execution.class.php @@ -11,7 +11,26 @@ class executionTest { global $tester; $this->executionModel = $tester->loadModel('execution'); - $this->treeModel = $tester->loadModel('tree'); + $this->treeModel = $tester->loadModel('tree'); + $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'); } /** @@ -730,12 +749,13 @@ class executionTest * function getTree test execution * * @param string $executionID - * @param string $count * @access public * @return array */ - public function getTreeTest($executionID, $count) + public function getTreeTest($executionID) { + global $app; + $app->moduleName = 'task'; $object = $this->executionModel->getTree($executionID); if(dao::isError()) @@ -743,13 +763,9 @@ class executionTest $error = dao::getError(); return $error; } - elseif($count == "1") - { - return count($object); - } else { - return $object; + return $object[0] ? count($object[0]->children) : 0; } } @@ -1793,6 +1809,31 @@ class executionTest } } + /** + * Function getBurnData test by execution. + * + * @param int $executionID + * @access public + * @return int + */ + public function getBurnDataTest($executionID = 0) + { + $execution = $this->executionModel->getByID($executionID); + if(empty($execution)) return '0'; + + $object = $this->executionModel->getBurnData(array($executionID => $execution)); + + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + else + { + return $object; + } + } + /** * function processBurnData test by execution * @@ -2692,7 +2733,7 @@ class executionTest * @param int $executionID * @param int $queryID * @access public - * @return void + * @return int */ public function buildTaskSearchFormTest($executionID, $queryID) { @@ -2700,4 +2741,97 @@ class executionTest return $_SESSION['tasksearchParams']['queryID']; } + + /** + * Test build bug search form. + * + * @param int $productID + * @param int $queryID + * @access public + * @return int + */ + public function buildBugSearchFormTest($productID, $queryID) + { + $product = $this->productModel->getByID($productID); + if(empty($product)) return '0'; + + $this->executionModel->loadModel('bug'); + $this->executionModel->buildBugSearchForm(array($productID => $product), $queryID, 'searchBug'); + + return $_SESSION['executionBugsearchParams']['queryID']; + } + + /** + * Test build story search form. + * + * @param int $executionID + * @param int $queryID + * @access public + * @return int + */ + public function buildStorySearchFormTest($executionID, $queryID) + { + $execution = $this->executionModel->getByID($executionID); + if(empty($execution)) return '0'; + + $this->executionModel->loadModel('story'); + $products = $this->productModel->getProducts($executionID); + $branchGroups = $this->executionModel->loadModel('branch')->getByProducts(array_keys($products)); + $this->executionModel->buildStorySearchForm($products, $branchGroups, array(), $queryID, 'searchStory', 'executionStory', $execution); + + return $_SESSION['executionStorysearchParams']['queryID']; + } + + /** + * Test get CFD data. + * + * @param int $executionID + * @access public + * @return array + */ + public function getCFDDataTest($executionID = 0) + { + $begin = strtotime('2022-01-12'); + $end = strtotime('2022-02-12'); + + $dateList = array(); + for($date = $begin; $date <= $end; $date += 24 * 3600) $dateList[] = date('Y-m-d', $date); + + return $this->executionModel->getCFDData($executionID, $dateList); + } + + /** + * Test build CFD data. + * + * @param int $executionID + * @access public + * @return array + */ + public function buildCFDDataTest($executionID = 0) + { + $begin = strtotime('2022-01-12'); + $end = strtotime('2022-02-12'); + + $dateList = array(); + for($date = $begin; $date <= $end; $date += 24 * 3600) $dateList[] = date('Y-m-d', $date); + + return $this->executionModel->buildCFDData($executionID, $dateList, 'task'); + } + + /** + * Test check CFD data. + * + * @param int $executionID + * @param string $date + * @access public + * @return array + */ + public function checkCFDDataTest($executionID, $date) + { + $this->executionModel->checkCFDData($executionID, $date); + return $this->executionModel->dao->select("date, `count` AS value, `name`")->from(TABLE_CFD) + ->where('execution')->eq((int)$executionID) + ->andWhere('date')->eq($date) + ->orderBy('date DESC, id asc')->fetchGroup('name', 'date'); + } } diff --git a/test/model/execution/buildbugsearchform.php b/test/model/execution/buildbugsearchform.php new file mode 100644 index 0000000000..de6ab9aebb --- /dev/null +++ b/test/model/execution/buildbugsearchform.php @@ -0,0 +1,78 @@ +#!/usr/bin/env php +id->range('1-5'); +$execution->name->range('项目1,项目2,迭代1,迭代2,迭代3'); +$execution->type->range('project{2},sprint,stage,kanban'); +$execution->status->range('doing'); +$execution->parent->range('0,0,1,1,2'); +$execution->project->range('0,0,1,1,2'); +$execution->grade->range('2{2},1{3}'); +$execution->path->range('1,2,`1,3`,`1,4`,`2,5`')->prefix(',')->postfix(','); +$execution->begin->range('20230102 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->end->range('20230212 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->gen(5); + +$product = zdTable('product'); +$product->id->range('1-3'); +$product->name->range('1-3')->prefix('产品'); +$product->code->range('1-3')->prefix('product'); +$product->type->range('normal'); +$product->status->range('normal'); +$product->gen(3); + +$task = zdTable('task'); +$task->id->range('1-10'); +$task->name->range('1-10')->prefix('任务'); +$task->execution->range('3-5'); +$task->type->range('test,devel'); +$task->status->range('wait,doing'); +$task->estimate->range('1-10'); +$task->left->range('1-10'); +$task->consumed->range('1-10'); +$task->gen(10); + +$bug = zdTable('bug'); +$bug->id->range('1-4'); +$bug->title->range('1-4')->prefix('Bug'); +$bug->project->range('1,2,1'); +$bug->execution->range('3,4,5'); +$bug->task->range('1-10'); +$bug->status->range('wait,doing'); +$bug->gen(4); + +$query = zdTable('userquery'); +$query->id->range('1'); +$query->account->range('admin'); +$query->module->range('bug'); +$query->title->range('搜索条件1'); +$query->form->range('`a:59:{s:9:"fieldname";s:0:"";s:11:"fieldstatus";s:0:"";s:9:"fielddesc";s:0:"";s:15:"fieldassignedTo";s:0:"";s:8:"fieldpri";s:1:"0";s:14:"fieldexecution";s:0:"";s:11:"fieldmodule";s:4:"ZERO";s:13:"fieldestimate";s:0:"";s:9:"fieldleft";s:0:"";s:13:"fieldconsumed";s:0:"";s:9:"fieldtype";s:0:"";s:12:"fieldfromBug";s:0:"";s:17:"fieldclosedReason";s:0:"";s:13:"fieldopenedBy";s:0:"";s:15:"fieldfinishedBy";s:0:"";s:13:"fieldclosedBy";s:0:"";s:15:"fieldcanceledBy";s:0:"";s:17:"fieldlastEditedBy";s:0:"";s:11:"fieldmailto";s:0:"";s:15:"fieldopenedDate";s:0:"";s:13:"fielddeadline";s:0:"";s:15:"fieldestStarted";s:0:"";s:16:"fieldrealStarted";s:0:"";s:17:"fieldassignedDate";s:0:"";s:17:"fieldfinishedDate";s:0:"";s:15:"fieldclosedDate";s:0:"";s:17:"fieldcanceledDate";s:0:"";s:19:"fieldlastEditedDate";s:0:"";s:18:"fieldactivatedDate";s:0:"";s:7:"fieldid";s:0:"";s:6:"andOr1";s:3:"AND";s:6:"field1";s:4:"name";s:9:"operator1";s:7:"include";s:6:"value1";s:3:"Bug";s:6:"andOr2";s:3:"and";s:6:"field2";s:2:"id";s:9:"operator2";s:1:"=";s:6:"value2";s:0:"";s:6:"andOr3";s:3:"and";s:6:"field3";s:6:"status";s:9:"operator3";s:1:"=";s:6:"value3";s:0:"";s:10:"groupAndOr";s:3:"and";s:6:"andOr4";s:3:"AND";s:6:"field4";s:4:"desc";s:9:"operator4";s:7:"include";s:6:"value4";s:0:"";s:6:"andOr5";s:3:"and";s:6:"field5";s:10:"assignedTo";s:9:"operator5";s:1:"=";s:6:"value5";s:0:"";s:6:"andOr6";s:3:"and";s:6:"field6";s:3:"pri";s:9:"operator6";s:1:"=";s:6:"value6";s:1:"0";s:6:"module";s:4:"task";s:9:"actionURL";s:41:"/execution-task-3-bySearch-myQueryID.html";s:10:"groupItems";s:1:"3";s:8:"formType";s:4:"lite";}`'); +$query->sql->range("`(( 1 AND `name` LIKE '%Bug%' ) AND ( 1 )) AND deleted = '0'`"); +$query->gen(1); + +su('admin'); + +/** + +title=测试executionModel->buildBugSearchForm(); +cid=1 +pid=1 + +正确的产品,正确的queryID >> 1 +错误的产品,正确的queryID >> 0 +正确的产品,错误的queryID >> 0 +错误的产品,错误的queryID >> 0 + +*/ + +$productIDList = array('1', '0'); +$queryIDList = array('0', '1'); + +$execution = new executionTest(); +r($execution->buildBugSearchFormTest($productIDList[0], $queryIDList[1])) && p() && e('1'); // 正确的产品,正确的queryID +r($execution->buildBugSearchFormTest($productIDList[1], $queryIDList[1])) && p() && e('0'); // 错误的产品,正确的queryID +r($execution->buildBugSearchFormTest($productIDList[0], $queryIDList[0])) && p() && e('0'); // 正确的产品,错误的queryID +r($execution->buildBugSearchFormTest($productIDList[1], $queryIDList[0])) && p() && e('0'); // 错误的产品,错误的queryID diff --git a/test/model/execution/buildcfddata.php b/test/model/execution/buildcfddata.php new file mode 100644 index 0000000000..f7ec33ff79 --- /dev/null +++ b/test/model/execution/buildcfddata.php @@ -0,0 +1,59 @@ +#!/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); + +$CFD = zdTable('cfd'); +$CFD->id->range('1-5'); +$CFD->execution->range('3'); +$CFD->count->range('1'); +$CFD->type->range('task,bug,story'); +$CFD->date->range('20220122 000000:0')->type('timestamp')->format('YY/MM/DD'); +$CFD->name->range('1-5')->prefix('看板列'); +$CFD->gen(5); + +/** + +title=测试executionModel->buildCFDData(); +cid=1 +pid=1 + +不存在执行的累计流图信息 >> 0 +存在的执行的累计流图信息 >> 2 + +*/ + +$executionTester = new executionTest(); + +r(count($executionTester->buildCFDDataTest())) && p() && e('0'); // 不存在执行的累计流图信息 + +$CFDData = $executionTester->buildCFDDataTest(3); +r(count($CFDData['line'])) && p() && e('2'); // 存在的执行的累计流图信息 diff --git a/test/model/execution/buildstorysearchform.php b/test/model/execution/buildstorysearchform.php new file mode 100644 index 0000000000..f8d2f10de2 --- /dev/null +++ b/test/model/execution/buildstorysearchform.php @@ -0,0 +1,96 @@ +#!/usr/bin/env php +id->range('1-5'); +$execution->name->range('项目1,项目2,迭代1,迭代2,迭代3'); +$execution->type->range('project{2},sprint,stage,kanban'); +$execution->status->range('doing'); +$execution->parent->range('0,0,1,1,2'); +$execution->project->range('0,0,1,1,2'); +$execution->grade->range('2{2},1{3}'); +$execution->path->range('1,2,`1,3`,`1,4`,`2,5`')->prefix(',')->postfix(','); +$execution->begin->range('20230102 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->end->range('20230212 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->gen(5); + +$task = zdTable('task'); +$task->id->range('1-10'); +$task->execution->range('3'); +$task->name->range('1-10')->prefix('任务'); +$task->type->range('design,devel,test,study,discuss,ui,affair,misc'); +$task->status->range('wait,doing,done,closed'); +$task->gen(10); + +$product = zdTable('product'); +$product->id->range('1-2'); +$product->name->range('正常产品1,多分支产品1'); +$product->type->range('normal,branch'); +$product->status->range('normal'); +$product->createdBy->range('admin,user1'); +$product->gen(2); + +$branch = zdTable('branch'); +$branch->id->range('1-2'); +$branch->product->range('2'); +$branch->name->range('分支1,分支2'); +$branch->status->range('active'); +$branch->gen(2); + +$story = zdTable('story'); +$story->id->range('1-10'); +$story->name->range('1-10')->prefix('需求'); +$story->type->range('story'); +$story->product->range('1'); +$story->status->range('active'); +$story->staged->range('projected'); +$story->version->range('1'); +$story->gen(10); + +$projectStory = zdTable('projectstory'); +$projectStory->project->range('3'); +$projectStory->product->range('1,2'); +$projectStory->story->range('1-10'); +$projectStory->version->range('1'); +$projectStory->gen(10); + +$projectproduct = zdTable('projectproduct'); +$projectproduct->project->range('1-5'); +$projectproduct->product->range('1-2'); +$projectproduct->plan->range('0'); +$projectproduct->gen(5); + +$query = zdTable('userquery'); +$query->id->range('1'); +$query->account->range('admin'); +$query->module->range('story'); +$query->title->range('搜索条件1'); +$query->form->range('`a:59:{s:9:"fieldname";s:0:"";s:11:"fieldstatus";s:0:"";s:9:"fielddesc";s:0:"";s:15:"fieldassignedTo";s:0:"";s:8:"fieldpri";s:1:"0";s:14:"fieldexecution";s:0:"";s:11:"fieldmodule";s:4:"ZERO";s:13:"fieldestimate";s:0:"";s:9:"fieldleft";s:0:"";s:13:"fieldconsumed";s:0:"";s:9:"fieldtype";s:0:"";s:12:"fieldfromBug";s:0:"";s:17:"fieldclosedReason";s:0:"";s:13:"fieldopenedBy";s:0:"";s:15:"fieldfinishedBy";s:0:"";s:13:"fieldclosedBy";s:0:"";s:15:"fieldcanceledBy";s:0:"";s:17:"fieldlastEditedBy";s:0:"";s:11:"fieldmailto";s:0:"";s:15:"fieldopenedDate";s:0:"";s:13:"fielddeadline";s:0:"";s:15:"fieldestStarted";s:0:"";s:16:"fieldrealStarted";s:0:"";s:17:"fieldassignedDate";s:0:"";s:17:"fieldfinishedDate";s:0:"";s:15:"fieldclosedDate";s:0:"";s:17:"fieldcanceledDate";s:0:"";s:19:"fieldlastEditedDate";s:0:"";s:18:"fieldactivatedDate";s:0:"";s:7:"fieldid";s:0:"";s:6:"andOr1";s:3:"AND";s:6:"field1";s:4:"name";s:9:"operator1";s:7:"include";s:6:"value1";s:2:"需求";s:6:"andOr2";s:3:"and";s:6:"field2";s:2:"id";s:9:"operator2";s:1:"=";s:6:"value2";s:0:"";s:6:"andOr3";s:3:"and";s:6:"field3";s:6:"status";s:9:"operator3";s:1:"=";s:6:"value3";s:0:"";s:10:"groupAndOr";s:3:"and";s:6:"andOr4";s:3:"AND";s:6:"field4";s:4:"desc";s:9:"operator4";s:7:"include";s:6:"value4";s:0:"";s:6:"andOr5";s:3:"and";s:6:"field5";s:10:"assignedTo";s:9:"operator5";s:1:"=";s:6:"value5";s:0:"";s:6:"andOr6";s:3:"and";s:6:"field6";s:3:"pri";s:9:"operator6";s:1:"=";s:6:"value6";s:1:"0";s:6:"module";s:4:"task";s:9:"actionURL";s:41:"/execution-task-3-bySearch-myQueryID.html";s:10:"groupItems";s:1:"3";s:8:"formType";s:4:"lite";}`'); +$query->sql->range("`(( 1 AND `name` LIKE '%需求%' ) AND ( 1 )) AND deleted = '0'`"); +$query->gen(1); + +su('admin'); + +/** + +title=测试executionModel->buildStorySearchForm(); +cid=1 +pid=1 + +正确的执行,正确的queryID >> 1 +错误的执行,正确的queryID >> 0 +正确的执行,错误的queryID >> 0 +错误的执行,错误的queryID >> 0 + +*/ + +$executionIDList = array('3', '0'); +$queryIDList = array('0', '1'); + +$execution = new executionTest(); +r($execution->buildStorySearchFormTest($executionIDList[0], $queryIDList[1])) && p() && e('1'); // 正确的执行,正确的queryID +r($execution->buildStorySearchFormTest($executionIDList[1], $queryIDList[1])) && p() && e('0'); // 错误的执行,正确的queryID +r($execution->buildStorySearchFormTest($executionIDList[0], $queryIDList[0])) && p() && e('0'); // 正确的执行,错误的queryID +r($execution->buildStorySearchFormTest($executionIDList[1], $queryIDList[0])) && p() && e('0'); // 错误的执行,错误的queryID diff --git a/test/model/execution/buildtasksearchform.php b/test/model/execution/buildtasksearchform.php index 32f0f20467..2e980cf3c6 100644 --- a/test/model/execution/buildtasksearchform.php +++ b/test/model/execution/buildtasksearchform.php @@ -52,11 +52,10 @@ pid=1 */ $executionIDList = array('3', '0'); -$queryIDList = array('0', '1'); +$queryIDList = array('0', '1'); $execution = new executionTest(); r($execution->buildTaskSearchFormTest($executionIDList[0], $queryIDList[1])) && p() && e('1'); // 正确的执行,正确的queryID r($execution->buildTaskSearchFormTest($executionIDList[1], $queryIDList[1])) && p() && e('1'); // 错误的执行,正确的queryID r($execution->buildTaskSearchFormTest($executionIDList[0], $queryIDList[0])) && p() && e('0'); // 正确的执行,错误的queryID r($execution->buildTaskSearchFormTest($executionIDList[1], $queryIDList[0])) && p() && e('0'); // 错误的执行,错误的queryID - diff --git a/test/model/execution/checkcfddata.php b/test/model/execution/checkcfddata.php new file mode 100644 index 0000000000..4bd0e3ea74 --- /dev/null +++ b/test/model/execution/checkcfddata.php @@ -0,0 +1,58 @@ +#!/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); + +$CFD = zdTable('cfd'); +$CFD->id->range('1-5'); +$CFD->execution->range('3'); +$CFD->count->range('1'); +$CFD->type->range('task,bug,story'); +$CFD->date->range('20220122 000000:0')->type('timestamp')->format('YY/MM/DD'); +$CFD->name->range('1-5')->prefix('看板列'); +$CFD->gen(5); + +/** + +title=测试executionModel->checkCFDData(); +cid=1 +pid=1 + +已有日期的情况 >> 5 +未来日期的情况 >> 0 + +*/ + +$executionTester = new executionTest(); +$dateList = array('2022-01-22', '2099-01-01'); + +r(count($executionTester->checkCFDDataTest(3, $dateList[0]))) && p() && e('5'); // 已有日期的情况 +r(count($executionTester->checkCFDDataTest(3, $dateList[1]))) && p() && e('0'); // 未来日期的情况 diff --git a/test/model/execution/computecfd.php b/test/model/execution/computecfd.php new file mode 100644 index 0000000000..ea112fcc48 --- /dev/null +++ b/test/model/execution/computecfd.php @@ -0,0 +1,54 @@ +#!/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); + +$CFD = zdTable('cfd'); +$CFD->id->range('1'); +$CFD->gen(0); + +/** + +title=测试executionModel->computeCFD(); +cid=1 +pid=1 + +获取所有看板执行的累计卡片个数 >> 6 +获取看板1的累计流图信息 >> 3,task + +*/ + +$executionTester = new executionTest(); +$allExecutionCFDList = $executionTester->computeCFDTest(); +$singleExecutionCFDList = $executionTester->computeCFDTest(3); + +r(count($allExecutionCFDList)) && p() && e('6'); // 获取所有看板执行的累计卡片个数 +r(current($singleExecutionCFDList)) && p('execution,type') && e('3,task'); // 获取看板1的累计流图信息 diff --git a/test/model/execution/filltasksintree.php b/test/model/execution/filltasksintree.php index 6309c140dd..ac095b2894 100644 --- a/test/model/execution/filltasksintree.php +++ b/test/model/execution/filltasksintree.php @@ -44,6 +44,7 @@ $product->parent->range('0,1{9}'); $product->type->range('task'); $product->gen(10); +zdTable('team')->gen(0); su('admin'); /** @@ -53,7 +54,7 @@ cid=1 pid=1 敏捷执行查询 >> 产品1 -瀑布执行查询 >> 产品1 +瀑布执行查询 >> 产品2 看板执行查询 >> 产品1 错误执行查询 >> 0 @@ -63,6 +64,6 @@ $executionIDList = array('0', '3', '4', '5'); $execution = new executionTest(); r($execution->fillTasksInTreeTest($executionIDList[1])) && p('name') && e('产品1'); // 敏捷执行查询 -r($execution->fillTasksInTreeTest($executionIDList[2])) && p('name') && e('产品1'); // 瀑布执行查询 +r($execution->fillTasksInTreeTest($executionIDList[2])) && p('name') && e('产品2'); // 瀑布执行查询 r($execution->fillTasksInTreeTest($executionIDList[3])) && p('name') && e('产品1'); // 看板执行查询 -r($execution->fillTasksInTreeTest($executionIDList[0])) && p() && e('0'); // 错误执行查询 +r($execution->fillTasksInTreeTest($executionIDList[0])) && p() && e('0'); // 错误执行查询 diff --git a/test/model/execution/getburndata.php b/test/model/execution/getburndata.php new file mode 100644 index 0000000000..bd0c325c77 --- /dev/null +++ b/test/model/execution/getburndata.php @@ -0,0 +1,55 @@ +#!/usr/bin/env php +gen(5); +su('admin'); + +$execution = zdTable('project'); +$execution->id->range('1-5'); +$execution->name->range('项目集1,项目1,迭代1,阶段1,看板1'); +$execution->type->range('program,project,sprint,stage,kanban'); +$execution->code->range('1-5')->prefix('code'); +$execution->parent->range('0,1,2{3}'); +$execution->status->range('wait{3},suspended,closed,doing'); +$execution->openedBy->range('admin,user1'); +$execution->begin->range('20220110 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->end->range('20220220 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->gen(5); + +$burn = zdTable('burn'); +$burn->execution->range('3{5},4{5},5{5}'); +$burn->date->range('20220111 000000:1D')->type('timestamp')->format('YY/MM/DD'); +$burn->estimate->range('94.3,56.3,55.3,37.8,33.8'); +$burn->left->range('95.3,68.5,73.9,40.2,36,3'); +$burn->consumed->range('20.1,33.4,41,56.55,59.55'); +$burn->storyPoint->range('0,16.5,16,11.5,9'); +$burn->gen(15); + +$task = zdTable('task'); +$task->id->range('1-10'); +$task->execution->range('3'); +$task->status->range('wait,doing'); +$task->estimate->range('1-10'); +$task->left->range('1-10'); +$task->consumed->range('1-10'); +$task->gen(10); + +/** + +title=测试executionModel->getBurnDataTest(); +cid=1 +pid=1 + +敏捷执行查询统计 >> 36 +瀑布执行查询统计 >> 40.2 +看板执行查询统计 >> 3 + +*/ + +$executionIDList = array(3, 4, 5); + +$execution = new executionTest(); +r(current($execution->getBurnDataTest($executionIDList[0]))) && p('2022-01-22:value') && e('36'); // 敏捷执行查询统计 +r(current($execution->getBurnDataTest($executionIDList[1]))) && p('2022-01-22:value') && e('40.2'); // 瀑布执行查询统计 +r(current($execution->getBurnDataTest($executionIDList[2]))) && p('2022-01-22:value') && e('3'); // 看板执行查询统计 diff --git a/test/model/execution/getcfddata.php b/test/model/execution/getcfddata.php new file mode 100644 index 0000000000..227da91738 --- /dev/null +++ b/test/model/execution/getcfddata.php @@ -0,0 +1,57 @@ +#!/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); + +$CFD = zdTable('cfd'); +$CFD->id->range('1-5'); +$CFD->execution->range('3'); +$CFD->count->range('1'); +$CFD->type->range('task,bug,story'); +$CFD->date->range('20220122 000000:0')->type('timestamp')->format('YY/MM/DD'); +$CFD->name->range('1-5')->prefix('看板列'); +$CFD->gen(5); + +/** + +title=测试executionModel->getCFDData(); +cid=1 +pid=1 + +不存在执行的累计流图信息 >> 0 +存在的执行的累计流图信息 >> 看板列3 + +*/ + +$executionTester = new executionTest(); + +r(count($executionTester->getCFDDataTest())) && p() && e('0'); // 不存在执行的累计流图信息 +r(current($executionTester->getCFDDataTest(3))) && p('2022-01-22:name') && e('看板列3'); // 存在的执行的累计流图信息 diff --git a/test/model/execution/getproductgrouplisttest.php b/test/model/execution/getproductgrouplist.php similarity index 100% rename from test/model/execution/getproductgrouplisttest.php rename to test/model/execution/getproductgrouplist.php diff --git a/test/model/execution/gettree.php b/test/model/execution/gettree.php new file mode 100755 index 0000000000..ed01b0d925 --- /dev/null +++ b/test/model/execution/gettree.php @@ -0,0 +1,59 @@ +#!/usr/bin/env php +id->range('1-5'); +$execution->name->range('项目1,项目2,迭代1,迭代2,迭代3'); +$execution->type->range('project{2},sprint,stage,kanban'); +$execution->status->range('doing'); +$execution->parent->range('0,0,1,1,2'); +$execution->project->range('0,0,1,1,2'); +$execution->grade->range('2{2},1{3}'); +$execution->openedVersion->range('18.0'); +$execution->path->range('1,2,`1,3`,`1,4`,`2,5`')->prefix(',')->postfix(','); +$execution->begin->range('20230102 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->end->range('20230212 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->gen(5); + +$task = zdTable('task'); +$task->id->range('1-10'); +$task->name->range('1-10')->prefix('任务'); +$task->execution->range('3-5'); +$task->type->range('test,devel'); +$task->status->range('wait,doing'); +$task->estimate->range('1-10'); +$task->left->range('1-10'); +$task->consumed->range('1-10'); +$task->gen(10); + +$product = zdTable('product'); +$product->id->range('1-3'); +$product->name->range('1-3')->prefix('产品'); +$product->code->range('1-3')->prefix('product'); +$product->type->range('normal'); +$product->status->range('normal'); +$product->gen(3); + +$product = zdTable('module'); +$product->id->range('1-10'); +$product->name->range('1-10')->prefix('模块'); +$product->root->range('1-3'); +$product->parent->range('0,1{9}'); +$product->type->range('task'); +$product->gen(10); + +/** + +title=测试 executionModel::getTree(); +cid=1 +pid=1 + +查看返回子任务数 >> 4 + +*/ +$executionTester = new executionTest(); + +r($executionTester->getTreeTest(3)) && p() && e('4'); // 查看返回子任务数 diff --git a/test/model/execution/importbug.php b/test/model/execution/importbug.php index 87ed786f02..63e82fc736 100755 --- a/test/model/execution/importbug.php +++ b/test/model/execution/importbug.php @@ -25,7 +25,6 @@ $task->left->range('3'); $task->consumed->range('3'); $task->gen(10); - $bug = zdTable('bug'); $bug->id->range('1-3,273'); $bug->title->range('1-4')->prefix('Bug'); diff --git a/test/model/program/gettreemenu.php b/test/model/program/gettreemenu.php index 9193622755..4571c251e4 100755 --- a/test/model/program/gettreemenu.php +++ b/test/model/program/gettreemenu.php @@ -26,6 +26,6 @@ pid=1 */ $programTester = new programTest(); $programs1 = $programTester->getTreeMenuTest(1); -$programs1 = preg_replace('/\s*/', '', strip_tags($programs1)); +$programs1 = preg_replace('/\s*/', '', strip_tags($programs1)); r($programs1) && p() && e('项目集1项目集2'); // 查看返回的字符个数