* Add test case.
This commit is contained in:
@@ -731,12 +731,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())
|
||||
@@ -744,13 +745,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2720,4 +2717,23 @@ class executionTest
|
||||
|
||||
return $_SESSION['executionBugsearchParams']['queryID'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build story search form.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function buildStorySearchFormTest($productID, $queryID)
|
||||
{
|
||||
$product = $this->productModel->getByID($productID);
|
||||
if(empty($product)) return '0';
|
||||
|
||||
$this->executionModel->loadModel('bug');
|
||||
$this->executionModel->buildStorySearchForm(array($productID => $product), $queryID, 'searchBug');
|
||||
|
||||
return $_SESSION['executionBugsearchParams']['queryID'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +65,4 @@ $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[3])) && p('name') && e('产品1'); // 看板执行查询
|
||||
r($execution->fillTasksInTreeTest($executionIDList[0])) && p() && e('0'); // 错误执行查询
|
||||
r($execution->fillTasksInTreeTest($executionIDList[0])) && p() && e('0'); // 错误执行查询
|
||||
|
||||
Executable
+59
@@ -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'); // 查看返回子任务数
|
||||
@@ -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'); // 查看返回的字符个数
|
||||
|
||||
Reference in New Issue
Block a user