Merge branch 'sprint/tsj_uinttest' into 'master'

Sprint/tsj uinttest

See merge request easycorp/zentaopms!6773
This commit is contained in:
王怡栋
2023-01-29 05:06:44 +00:00
11 changed files with 358 additions and 16 deletions
+1 -1
View File
@@ -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)
{
+64 -8
View File
@@ -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;
}
}
@@ -2700,4 +2716,44 @@ class executionTest
return $_SESSION['tasksearchParams']['queryID'];
}
/**
* Test build bug search form.
*
* @param int $productID
* @param int $queryID
* @access public
* @return void
*/
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 void
*/
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'];
}
}
@@ -0,0 +1,78 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
$execution = zdTable('project');
$execution->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
@@ -0,0 +1,96 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
$execution = zdTable('project');
$execution->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
+1 -2
View File
@@ -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
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
zdTable('user')->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的累计流图信息
+4 -3
View File
@@ -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'); // 错误执行查询
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
$execution = zdTable('project');
$execution->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'); // 查看返回子任务数
-1
View File
@@ -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');
+1 -1
View File
@@ -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'); // 查看返回的字符个数