Merge branch 'sprint/unitTest_liumengyi_tree' into 'master'
* Add unit test of tree. See merge request easycorp/zentaopms!2964
This commit is contained in:
@@ -1666,7 +1666,7 @@ class treeModel extends model
|
||||
if(!isset($_POST['branch'])) $module->branch = $self->branch;
|
||||
|
||||
$repeatName = $this->checkUnique($self, array("id{$self->id}" => $module->name), array("id{$self->id}" => $module->branch));
|
||||
if($repeatName) return print(js::alert(sprintf($this->lang->tree->repeatName, $repeatName)));
|
||||
if($repeatName) helper::end(js::alert(sprintf($this->lang->tree->repeatName, $repeatName)));
|
||||
|
||||
$parent = $this->getById($this->post->parent);
|
||||
$childs = $this->getAllChildId($moduleID);
|
||||
|
||||
+215
-140
@@ -96,13 +96,25 @@ class treeTest
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create an option menu of task in html.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @param int $startModule
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTaskOptionMenuTest($rootID, $productID = 0, $startModule = 0, $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->getTaskOptionMenu($rootID, $productID = 0, $startModule = 0, $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
$names = '';
|
||||
foreach($objects as $object) $names .= ',' . $object;
|
||||
return $names;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,87 +141,76 @@ class treeTest
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getTreeMenuTest($rootID, $type = 'root', $startModule = 0, $userFunc = '', $extra = '', $branch = 0, $extraParams = '')
|
||||
{
|
||||
$objects = $this->objectModel->getTreeMenu($rootID, $type = 'root', $startModule = 0, $userFunc = '', $extra = '', $branch = 0, $extraParams = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getTaskTreeMenuTest($rootID, $productID = 0, $startModule = 0, $userFunc = '', $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->getTaskTreeMenu($rootID, $productID = 0, $startModule = 0, $userFunc = '', $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get full task tree.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTaskStructureTest($rootID, $productID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getTaskStructure($rootID, $productID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
$child = '';
|
||||
foreach($objects as $object)
|
||||
{
|
||||
if(is_array($object)) $child .= isset($object['children']) ? $object['name'] . ':' . count($object['children']) . ';' : $object['name'] . ':0';
|
||||
if(is_object($object)) $child .= isset($object->children) ? "$object->name:" . count($object->children) . ';' : "$object->name:0";
|
||||
}
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get tree structure.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTreeStructureTest($rootID, $type)
|
||||
{
|
||||
$objects = $this->objectModel->getTreeStructure($rootID, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getBugTreeMenuTest($rootID, $productID = 0, $startModule = 0, $userFunc = '', $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->getBugTreeMenu($rootID, $productID = 0, $startModule = 0, $userFunc = '', $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getCaseTreeMenuTest($rootID, $productID = 0, $startModule = 0, $userFunc = '', $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->getCaseTreeMenu($rootID, $productID = 0, $startModule = 0, $userFunc = '', $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getProjectStoryTreeMenuTest($rootID, $startModule = 0, $userFunc = '')
|
||||
{
|
||||
$objects = $this->objectModel->getProjectStoryTreeMenu($rootID, $startModule = 0, $userFunc = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function buildTreeTest(& $treeMenu, $module, $type, $userFunc, $extra, $branch = 'all')
|
||||
{
|
||||
$objects = $this->objectModel->buildTree($treeMenu, $module, $type, $userFunc, $extra, $branch = 'all');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
$child = '';
|
||||
foreach($objects as $object) $child .= isset($object->children) ? "$object->id:" . count($object->children) . ';' : "$object->id:0;";
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get execution modules.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param bool $parent
|
||||
* @param string $linkObject
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTaskTreeModulesTest($executionID, $parent = false, $linkObject = 'story')
|
||||
{
|
||||
$objects = $this->objectModel->getTaskTreeModules($executionID, $parent = false, $linkObject = 'story');
|
||||
$objects = $this->objectModel->getTaskTreeModules($executionID, $parent, $linkObject);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create story link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param array $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createStoryLinkTest($moduleID, $extra = array())
|
||||
{
|
||||
$type = '';
|
||||
@@ -224,15 +225,6 @@ class treeTest
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function createLineLinkTest($moduleID, $extra)
|
||||
{
|
||||
$objects = $this->objectModel->createLineLink($type, $module, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create task link.
|
||||
*
|
||||
@@ -255,15 +247,6 @@ class treeTest
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function createProjectStoryLinkTest($type, $module, $extra)
|
||||
{
|
||||
$objects = $this->objectModel->createProjectStoryLink($type, $module, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create requirment link.
|
||||
*
|
||||
@@ -285,15 +268,14 @@ class treeTest
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function createDocLinkTest($type, $module, $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->createDocLink($type, $module, $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create manage link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param array $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createManageLinkTest($moduleID, $extra)
|
||||
{
|
||||
$type = 0;
|
||||
@@ -306,6 +288,14 @@ class treeTest
|
||||
return substr($link, 0, 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create task manage link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param array $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createTaskManageLinkTest($moduleID, $extra)
|
||||
{
|
||||
$type = '';
|
||||
@@ -406,15 +396,6 @@ class treeTest
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function createBranchLinkTest($type, $rootID, $branchID, $branch)
|
||||
{
|
||||
$objects = $this->objectModel->createBranchLink($type, $rootID, $branchID, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create feedback link.
|
||||
*
|
||||
@@ -436,49 +417,45 @@ class treeTest
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function createTrainSkillLinkTest($type, $module, $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->createTrainSkillLink($type, $module, $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function createTrainCourseLinkTest($type, $module, $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->createTrainCourseLink($type, $module, $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function createTrainPostLinkTest($type, $module, $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->createTrainPostLink($type, $module, $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get sons of a module.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $moduleID
|
||||
* @param string $type
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSonsTest($rootID, $moduleID, $type = 'root', $branch = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getSons($rootID, $moduleID, $type = 'root', $branch = 0);
|
||||
$objects = $this->objectModel->getSons($rootID, $moduleID, $type, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object->id;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get sons of a task module.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTaskSonsTest($rootID, $productID, $moduleID)
|
||||
{
|
||||
$objects = $this->objectModel->getTaskSons($rootID, $productID, $moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object->id;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -499,13 +476,23 @@ class treeTest
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get project module.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectModuleTest($projectID, $productID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getProjectModule($projectID, $productID = 0);
|
||||
$objects = $this->objectModel->getProjectModule($projectID, $productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
$ids = '';
|
||||
foreach($objects as $objectID) $ids .= ',' . $objectID;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -542,13 +529,20 @@ class treeTest
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get the module that its type == 'story'.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getStoryModuleTest($moduleID)
|
||||
{
|
||||
$objects = $this->objectModel->getStoryModule($moduleID);
|
||||
$object = $this->objectModel->getStoryModule($moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -569,31 +563,86 @@ class treeTest
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update modules' order.
|
||||
*
|
||||
* @param array $orders
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function updateOrderTest($orders)
|
||||
{
|
||||
$objects = $this->objectModel->updateOrder($orders);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_MODULE)->where('id')->in(array_keys($orders))->orderBy('`order` asc')->fetchAll();
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object->id;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
public function manageChildTest($rootID, $type)
|
||||
/**
|
||||
* Test manage childs of a module.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $type
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function manageChildTest($rootID, $type, $param)
|
||||
{
|
||||
$objects = $this->objectModel->manageChild($rootID, $type);
|
||||
$_POST['allProduct'] = 100;
|
||||
$_POST['productModule'] = 0;
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->manageChild($rootID, $type);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_MODULE)->where('parent')->eq($param['parentModuleID'])->andWhere('deleted')->eq(0)->fetchAll();
|
||||
|
||||
$names = '';
|
||||
foreach($objects as $object) $names .= ',' . $object->name;
|
||||
return $names;
|
||||
}
|
||||
|
||||
public function updateTest($moduleID)
|
||||
/**
|
||||
* Test update a module.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateTest($moduleID, $param)
|
||||
{
|
||||
$objects = $this->objectModel->update($moduleID);
|
||||
$fields = array('root', 'branch', 'parent', 'name', 'short');
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
foreach($fields as $field)
|
||||
{
|
||||
if(isset($param[$field]))
|
||||
{
|
||||
$_POST[$field] = $param[$field];
|
||||
}
|
||||
else
|
||||
{
|
||||
$_POST[$field] = $module->$field;
|
||||
}
|
||||
}
|
||||
|
||||
$this->objectModel->update($moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
$object = $this->objectModel->getByID($moduleID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -675,22 +724,42 @@ class treeTest
|
||||
return $repeatName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check merge module version.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $viewType
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function isMergeModuleTest($rootID, $viewType)
|
||||
{
|
||||
$objects = $this->objectModel->isMergeModule($rootID, $viewType);
|
||||
$object = $this->objectModel->isMergeModule($rootID, $viewType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
return $object ? 1 : 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get full trees.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $viewType
|
||||
* @param string $branchID
|
||||
* @param int $currentModuleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProductStructureTest($rootID, $viewType, $branchID = 'all', $currentModuleID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getProductStructure($rootID, $viewType, $branchID = 'all', $currentModuleID = 0);
|
||||
$objects = $this->objectModel->getProductStructure($rootID, $viewType, $branchID, $currentModuleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
$child = '';
|
||||
foreach($objects as $object) $child .= isset($object->children) ? "$object->id:" . count($object->children) . ';' : "$object->id:0;";
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -717,6 +786,12 @@ class treeTest
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get all doc structure.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getDocStructureTest()
|
||||
{
|
||||
$objects = $this->objectModel->getDocStructure();
|
||||
|
||||
@@ -16,6 +16,6 @@ $type = array('bug', 'case', 'task');
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getAllModulePairsTest()) && p() && e('3601'); // 测试获取默认(task)的模块信息
|
||||
r($tree->getAllModulePairsTest($type[0])) && p() && e('1201'); // 测试获取默认(task)的模块信息
|
||||
r($tree->getAllModulePairsTest($type[1])) && p() && e('1201'); // 测试获取默认(task)的模块信息
|
||||
r($tree->getAllModulePairsTest($type[0])) && p() && e('1501'); // 测试获取默认(task)的模块信息
|
||||
r($tree->getAllModulePairsTest($type[1])) && p() && e('1501'); // 测试获取默认(task)的模块信息
|
||||
r($tree->getAllModulePairsTest($type[2])) && p() && e('3601'); // 测试获取默认(task)的模块信息
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->getProductStructure();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$root = array(1, 2, 3, 41, 42, 43, 101, 102, 103);
|
||||
$type = array('story', 'task', 'doc');
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getProductStructureTest($root[0], $type[0])) && p() && e('1821:2;2221:2;1822:0;2222:0;1823:0;2223:0;1824:0;2224:0;'); // 测试获取 root 1 type story 的树结构
|
||||
r($tree->getProductStructureTest($root[1], $type[0])) && p() && e('1825:2;2225:2;1826:0;2226:0;1827:0;2227:0;1828:0;2228:0;'); // 测试获取 root 2 type story 的树结构
|
||||
r($tree->getProductStructureTest($root[2], $type[0])) && p() && e('1831:0;2231:0;1832:0;2232:0;1829:2;2229:2;1830:0;2230:0;'); // 测试获取 root 3 type story 的树结构
|
||||
r($tree->getProductStructureTest($root[3], $type[0])) && p() && e('1981:2;2381:2;1982:0;2382:0;1983:0;2383:0;1984:0;2384:0;'); // 测试获取 root 41 type story 的树结构
|
||||
r($tree->getProductStructureTest($root[4], $type[0])) && p() && e('1985:2;2385:2;1986:0;2386:0;1987:0;2387:0;1988:0;2388:0;'); // 测试获取 root 42 type story 的树结构
|
||||
r($tree->getProductStructureTest($root[5], $type[0])) && p() && e('1991:0;2391:0;1992:0;2392:0;1989:2;2389:2;1990:0;2390:0;'); // 测试获取 root 43 type story 的树结构
|
||||
r($tree->getProductStructureTest($root[6], $type[1])) && p() && e('0'); // 测试获取 root 101 type task 的树结构
|
||||
r($tree->getProductStructureTest($root[7], $type[1])) && p() && e('0'); // 测试获取 root 102 type task 的树结构
|
||||
r($tree->getProductStructureTest($root[8], $type[1])) && p() && e('0'); // 测试获取 root 103 type task 的树结构
|
||||
r($tree->getProductStructureTest($root[0], $type[2])) && p() && e('3621:2;'); // 测试获取 root 1 type doc 的树结构
|
||||
r($tree->getProductStructureTest($root[1], $type[2])) && p() && e('3622:2;'); // 测试获取 root 2 type doc 的树结构
|
||||
r($tree->getProductStructureTest($root[2], $type[2])) && p() && e('3623:2;'); // 测试获取 root 3 type doc 的树结构
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->getProjectModule();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$projectID = 1;
|
||||
$productID = array(1, 2, 3, 4, 5, 6);
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getProjectModuleTest($projectID, $productID[0])) && p() && e(',1821,2621,2622,1822,1823,1824,2221,2821,2822,2222,2223,2224'); // 测试获取项目模块 1
|
||||
r($tree->getProjectModuleTest($projectID, $productID[1])) && p() && e(',1825,2623,2624,1826,1827,1828,2225,2823,2824,2226,2227,2228'); // 测试获取项目模块 2
|
||||
r($tree->getProjectModuleTest($projectID, $productID[2])) && p() && e(',1829,2625,2626,1830,1831,1832,2229,2825,2826,2230,2231,2232'); // 测试获取项目模块 3
|
||||
r($tree->getProjectModuleTest($projectID, $productID[3])) && p() && e(',1833,2627,2628,1834,1835,1836,2233,2827,2828,2234,2235,2236'); // 测试获取项目模块 4
|
||||
r($tree->getProjectModuleTest($projectID, $productID[4])) && p() && e(',1837,2629,2630,1838,1839,1840,2237,2829,2830,2238,2239,2240'); // 测试获取项目模块 5
|
||||
r($tree->getProjectModuleTest($projectID, $productID[5])) && p() && e(',1841,2631,2632,1842,1843,1844,2241,2831,2832,2242,2243,2244'); // 测试获取项目模块 6
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->getSons();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$root = array(1, 2, 41, 42, 101, 102);
|
||||
$module = array(1821, 1825, 1981, 1982, 1985, 1987, 21, 24, 3621, 3622);
|
||||
$type = array('story', 'task', 'doc');
|
||||
$branch = array(0, 1, 2);
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getSonsTest($root[0], $module[0], $type[0], $branch[0])) && p() && e(',2621,2622'); // 测试获取root 1 module 1821 type story branch 0 的子module
|
||||
r($tree->getSonsTest($root[1], $module[1], $type[0], $branch[0])) && p() && e(',2623,2624'); // 测试获取root 2 module 1822 type story branch 0 的子module
|
||||
r($tree->getSonsTest($root[2], $module[2], $type[0], $branch[0])) && p() && e(',2701,2702'); // 测试获取root 41 module 1981 type story branch 0 的子module
|
||||
r($tree->getSonsTest($root[2], $module[2], $type[0], $branch[1])) && p() && e(',2701,2702'); // 测试获取root 41 module 1981 type story branch 1 的子module
|
||||
r($tree->getSonsTest($root[2], $module[2], $type[0], $branch[2])) && p() && e(',2701,2702'); // 测试获取root 41 module 1981 type story branch 2 的子module
|
||||
r($tree->getSonsTest($root[2], $module[3], $type[0], $branch[0])) && p() && e('0'); // 测试获取root 41 module 1982 type story branch 0 的子module
|
||||
r($tree->getSonsTest($root[2], $module[3], $type[0], $branch[1])) && p() && e('0'); // 测试获取root 41 module 1982 type story branch 1 的子module
|
||||
r($tree->getSonsTest($root[2], $module[3], $type[0], $branch[2])) && p() && e('0'); // 测试获取root 41 module 1982 type story branch 2 的子module
|
||||
r($tree->getSonsTest($root[3], $module[4], $type[0], $branch[0])) && p() && e(',2703,2704'); // 测试获取root 42 module 1985 type story branch 0 的子module
|
||||
r($tree->getSonsTest($root[3], $module[4], $type[0], $branch[1])) && p() && e(',2703,2704'); // 测试获取root 42 module 1985 type story branch 1 的子module
|
||||
r($tree->getSonsTest($root[3], $module[4], $type[0], $branch[2])) && p() && e(',2703,2704'); // 测试获取root 42 module 1985 type story branch 2 的子module
|
||||
r($tree->getSonsTest($root[3], $module[5], $type[0], $branch[0])) && p() && e('0'); // 测试获取root 42 module 1987 type story branch 0 的子module
|
||||
r($tree->getSonsTest($root[3], $module[5], $type[0], $branch[1])) && p() && e('0'); // 测试获取root 42 module 1987 type story branch 1 的子module
|
||||
r($tree->getSonsTest($root[3], $module[5], $type[0], $branch[2])) && p() && e('0'); // 测试获取root 42 module 1987 type story branch 2 的子module
|
||||
r($tree->getSonsTest($root[4], $module[6], $type[1], $branch[0])) && p() && e(',3021'); // 测试获取root 101 module 21 type task branch 0 的子module
|
||||
r($tree->getSonsTest($root[5], $module[7], $type[1], $branch[0])) && p() && e('0'); // 测试获取root 102 module 22 type task branch 0 的子module
|
||||
r($tree->getSonsTest($root[0], $module[8], $type[2], $branch[0])) && p() && e(',3721,3722'); // 测试获取root 1 module 3621 type doc branch 0 的子module
|
||||
r($tree->getSonsTest($root[1], $module[9], $type[2], $branch[0])) && p() && e(',3723,3724'); // 测试获取root 2 module 3621 type doc branch 0 的子module
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->getStoryModule();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$moduleID = array(1821, 1822, 1982, 1983, 2621, 2622, 21, 3021);
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getStoryModuleTest($moduleID[0])) && p() && e('1821'); // 测试获取module 1821 的story模块
|
||||
r($tree->getStoryModuleTest($moduleID[1])) && p() && e('1822'); // 测试获取module 1822 的story模块
|
||||
r($tree->getStoryModuleTest($moduleID[2])) && p() && e('1982'); // 测试获取module 1982 的story模块
|
||||
r($tree->getStoryModuleTest($moduleID[3])) && p() && e('1983'); // 测试获取module 1983 的story模块
|
||||
r($tree->getStoryModuleTest($moduleID[4])) && p() && e('2621'); // 测试获取module 2621 的story模块
|
||||
r($tree->getStoryModuleTest($moduleID[5])) && p() && e('2622'); // 测试获取module 2622 的story模块
|
||||
r($tree->getStoryModuleTest($moduleID[6])) && p() && e('0'); // 测试获取module 21 的story模块
|
||||
r($tree->getStoryModuleTest($moduleID[7])) && p() && e('0'); // 测试获取module 3021 的story模块
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->getTaskOptionMenu();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$root = array(1, 2, 3, 41, 42, 43, 101, 102, 103);
|
||||
$productID = 1;
|
||||
$startModule = 3021;
|
||||
$extra = 'allModule';
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getTaskOptionMenuTest($root[0])) && p() && e(',/'); // 测试获取 root 1 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[1])) && p() && e(',/'); // 测试获取 root 2 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[2])) && p() && e(',/'); // 测试获取 root 3 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[3])) && p() && e(',/,/已关闭的正常产品31/产品模块122,/已关闭的正常产品31/产品模块124'); // 测试获取 root 41 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[4])) && p() && e(',/,/已关闭的正常产品32/产品模块126,/已关闭的正常产品32/产品模块128'); // 测试获取 root 42 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[5])) && p() && e(',/,/已关闭的正常产品33/产品模块132,/已关闭的正常产品33/产品模块130'); // 测试获取 root 43 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[6])) && p() && e(',/,/正常产品1/产品模块2,/正常产品1/产品模块4,/模块1,/模块1/执行子模块1,/模块2,/模块3'); // 测试获取 root 101 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[6], $productID)) && p() && e(',/,/正常产品1/产品模块2,/正常产品1/产品模块4,/模块1,/模块1/执行子模块1,/模块2,/模块3'); // 测试获取 root 101 product 1 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[6], $productID, $startModule)) && p() && e(',/,/正常产品1/产品模块2,/正常产品1/产品模块4,/模块1,/模块1/执行子模块1,/模块2,/模块3'); // 测试获取 root 101 product 1 startModule 3021 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[6], $productID, $startModule, $extra)) && p() && e(',/,/正常产品1/产品模块2,/正常产品1/产品模块4,/模块1,/模块1/执行子模块1,/模块2,/模块3'); // 测试获取 root 101 product 1 startModule 3021 allModule task目录
|
||||
r($tree->getTaskOptionMenuTest($root[7])) && p() && e(',/,/正常产品2/产品模块6,/正常产品2/产品模块8,/模块4,/模块5,/模块6'); // 测试获取 root 102 task目录
|
||||
r($tree->getTaskOptionMenuTest($root[8])) && p() && e(',/,/正常产品3/产品模块12,/正常产品3/产品模块10,/模块7,/模块8,/模块9'); // 测试获取 root 103 task目录
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->getTaskSons();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$rootID = array(1, 2, 101, 102);
|
||||
$productID = array(0, 1, 2);
|
||||
$moduleID = array(0, 1821, 1825, 21, 23);
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getTaskSonsTest($rootID[0], $productID[1], $moduleID[0])) && p() && e(',1821,2221,1822,2222,1823,2223,1824,2224'); // 测试获取 root 1 product 1 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[0], $productID[2], $moduleID[0])) && p() && e(',1825,2225,1826,2226,1827,2227,1828,2228'); // 测试获取 root 1 product 2 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[0], $productID[0], $moduleID[1])) && p() && e(',2621,2622'); // 测试获取 root 1 module 1821 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[0], $productID[0], $moduleID[2])) && p() && e('0'); // 测试获取 root 1 module 1825 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[0], $productID[0], $moduleID[3])) && p() && e('0'); // 测试获取 root 1 module 21 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[0], $productID[0], $moduleID[4])) && p() && e('0'); // 测试获取 root 1 module 23 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[1], $productID[1], $moduleID[0])) && p() && e(',1821,2221,1822,2222,1823,2223,1824,2224'); // 测试获取 root 2 product 1 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[1], $productID[2], $moduleID[0])) && p() && e(',1825,2225,1826,2226,1827,2227,1828,2228'); // 测试获取 root 2 product 2 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[1], $productID[0], $moduleID[1])) && p() && e('0'); // 测试获取 root 2 module 1821 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[1], $productID[0], $moduleID[2])) && p() && e(',2623,2624'); // 测试获取 root 2 module 1825 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[1], $productID[0], $moduleID[3])) && p() && e('0'); // 测试获取 root 2 module 21 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[1], $productID[0], $moduleID[4])) && p() && e('0'); // 测试获取 root 2 module 23 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[2], $productID[1], $moduleID[0])) && p() && e(',1821,2221,21,1822,2222,22,1823,2223,23,1824,2224 '); // 测试获取 root 101 product 1 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[2], $productID[2], $moduleID[0])) && p() && e(',21,22,23,1825,2225,1826,2226,1827,2227,1828,2228 '); // 测试获取 root 101 product 2 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[2], $productID[0], $moduleID[1])) && p() && e('0'); // 测试获取 root 101 module 1821 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[2], $productID[0], $moduleID[2])) && p() && e('0'); // 测试获取 root 101 module 1825 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[2], $productID[0], $moduleID[3])) && p() && e(',3021'); // 测试获取 root 101 module 21 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[2], $productID[0], $moduleID[4])) && p() && e('0'); // 测试获取 root 101 module 23 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[3], $productID[1], $moduleID[0])) && p() && e(',1821,2221,1822,2222,1823,2223,1824,2224,24,25,26 '); // 测试获取 root 102 product 1 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[3], $productID[2], $moduleID[0])) && p() && e(',24,1825,2225,25,1826,2226,26,1827,2227,1828,2228 '); // 测试获取 root 102 product 2 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[3], $productID[0], $moduleID[1])) && p() && e('0'); // 测试获取 root 102 module 1821 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[3], $productID[0], $moduleID[2])) && p() && e('0'); // 测试获取 root 102 module 1825 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[3], $productID[0], $moduleID[3])) && p() && e('0'); // 测试获取 root 102 module 21 task模块的子模块
|
||||
r($tree->getTaskSonsTest($rootID[3], $productID[0], $moduleID[4])) && p() && e(',3022'); // 测试获取 root 102 module 23 task模块的子模块
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->getTaskStructure();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$root = array(101, 102, 103, 104, 105, 106);
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getTaskStructureTest($root[0])) && p() && e('正常产品1:2;多平台产品81:0;多平台产品91:0;模块1:1;模块2:0模块3:0'); // 获取root 101 的task 结构
|
||||
r($tree->getTaskStructureTest($root[1])) && p() && e('正常产品2:2;多平台产品82:0;多平台产品92:0;模块4:0模块5:0模块6:0'); // 获取root 102 的task 结构
|
||||
r($tree->getTaskStructureTest($root[2])) && p() && e('正常产品3:2;多平台产品83:0;多平台产品93:0;模块7:0模块8:0模块9:0'); // 获取root 103 的task 结构
|
||||
r($tree->getTaskStructureTest($root[3])) && p() && e('正常产品4:2;多平台产品84:0;多平台产品94:0;模块11:0模块12:0模块10:0'); // 获取root 104 的task 结构
|
||||
r($tree->getTaskStructureTest($root[4])) && p() && e('正常产品5:2;多平台产品85:0;多平台产品95:0;模块13:0模块14:0模块15:0'); // 获取root 105 的task 结构
|
||||
r($tree->getTaskStructureTest($root[5])) && p() && e('正常产品6:2;多平台产品86:0;多平台产品96:0;模块16:0模块17:0模块18:0'); // 获取root 106 的task 结构
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->getTaskTreeModules();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$executionID = array(101, 102, 103, 104);
|
||||
$parent = array(false, true);
|
||||
$linkObject = array('story', 'case');
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getTaskTreeModulesTest($executionID[0], $parent[0], $linkObject[0])) && p() && e(',1822,1824,21,22,23,3021'); // 测试获取 execution 101 parent false story 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[1], $parent[0], $linkObject[0])) && p() && e(',1826,1828,24,25,26,3022'); // 测试获取 execution 102 parent false story 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[2], $parent[0], $linkObject[0])) && p() && e(',1830,1832,27,28,29,3023'); // 测试获取 execution 103 parent false story 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[3], $parent[0], $linkObject[0])) && p() && e(',1834,1836,30,31,32,3024'); // 测试获取 execution 104 parent false story 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[0], $parent[1], $linkObject[0])) && p() && e(',,1822,1824,21,22,23,3021'); // 测试获取 execution 101 parent true story 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[1], $parent[1], $linkObject[0])) && p() && e(',,1826,1828,24,25,26,23,3022'); // 测试获取 execution 102 parent true story 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[2], $parent[1], $linkObject[0])) && p() && e(',,1830,1832,27,28,29,25,3023'); // 测试获取 execution 103 parent true story 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[3], $parent[1], $linkObject[0])) && p() && e(',,1834,1836,30,31,32,27,3024'); // 测试获取 execution 104 parent true story 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[0], $parent[0], $linkObject[1])) && p() && e(',21,22,23,3021'); // 测试获取 execution 101 parent false case 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[1], $parent[0], $linkObject[1])) && p() && e(',24,25,26,3022'); // 测试获取 execution 102 parent false case 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[2], $parent[0], $linkObject[1])) && p() && e(',27,28,29,3023'); // 测试获取 execution 103 parent false case 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[3], $parent[0], $linkObject[1])) && p() && e(',30,31,32,3024'); // 测试获取 execution 104 parent false case 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[0], $parent[1], $linkObject[1])) && p() && e(',,21,22,23,3021'); // 测试获取 execution 101 parent true case 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[1], $parent[1], $linkObject[1])) && p() && e(',,24,25,26,23,3022'); // 测试获取 execution 102 parent true case 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[2], $parent[1], $linkObject[1])) && p() && e(',,27,28,29,25,3023'); // 测试获取 execution 103 parent true case 的树
|
||||
r($tree->getTaskTreeModulesTest($executionID[3], $parent[1], $linkObject[1])) && p() && e(',,30,31,32,27,3024'); // 测试获取 execution 104 parent true case 的树
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->getTreeStructure();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$root = array(1, 2, 3, 41, 42, 43, 101, 102, 103);
|
||||
$type = array('story', 'case', 'doc', 'task');
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->getTreeStructureTest($root[0], $type[0])) && p() && e('1821:2;2221:2;1822:0;2222:0;1823:0;2223:0;1824:0;2224:0;'); // 测试获取root 1 story 的树结构
|
||||
r($tree->getTreeStructureTest($root[1], $type[0])) && p() && e('1825:2;2225:2;1826:0;2226:0;1827:0;2227:0;1828:0;2228:0;'); // 测试获取root 2 story 的树结构
|
||||
r($tree->getTreeStructureTest($root[2], $type[0])) && p() && e('1831:0;2231:0;1832:0;2232:0;1829:2;2229:2;1830:0;2230:0;'); // 测试获取root 3 story 的树结构
|
||||
r($tree->getTreeStructureTest($root[3], $type[0])) && p() && e('1981:2;2381:2;1982:0;2382:0;1983:0;2383:0;1984:0;2384:0;'); // 测试获取root 41 story 的树结构
|
||||
r($tree->getTreeStructureTest($root[4], $type[0])) && p() && e('1985:2;2385:2;1986:0;2386:0;1987:0;2387:0;1988:0;2388:0;'); // 测试获取root 42 story 的树结构
|
||||
r($tree->getTreeStructureTest($root[5], $type[0])) && p() && e('1991:0;2391:0;1992:0;2392:0;1989:2;2389:2;1990:0;2390:0;'); // 测试获取root 43 story 的树结构
|
||||
r($tree->getTreeStructureTest($root[0], $type[1])) && p() && e('1821:2;2221:2;3921:2;1822:0;2222:0;1823:0;2223:0;1824:0;2224:0;'); // 测试获取root 1 case 的树结构
|
||||
r($tree->getTreeStructureTest($root[1], $type[1])) && p() && e('3922:2;1825:2;2225:2;1826:0;2226:0;1827:0;2227:0;1828:0;2228:0;'); // 测试获取root 2 case 的树结构
|
||||
r($tree->getTreeStructureTest($root[2], $type[1])) && p() && e('1831:0;2231:0;1832:0;2232:0;3923:2;1829:2;2229:2;1830:0;2230:0;'); // 测试获取root 3 case 的树结构
|
||||
r($tree->getTreeStructureTest($root[0], $type[2])) && p() && e('3621:2;'); // 测试获取root 1 doc 的树结构
|
||||
r($tree->getTreeStructureTest($root[1], $type[2])) && p() && e('3622:2;'); // 测试获取root 2 doc 的树结构
|
||||
r($tree->getTreeStructureTest($root[2], $type[2])) && p() && e('3623:2;'); // 测试获取root 3 doc 的树结构
|
||||
r($tree->getTreeStructureTest($root[6], $type[3])) && p() && e('0'); // 测试获取root 101 task 的树结构
|
||||
r($tree->getTreeStructureTest($root[7], $type[3])) && p() && e('0'); // 测试获取root 102 task 的树结构
|
||||
r($tree->getTreeStructureTest($root[8], $type[3])) && p() && e('0'); // 测试获取root 103 task 的树结构
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->isMergeModule();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$root = array(1, 2, 3, 101, 102, 103);
|
||||
$type = array('bug', 'case', 'task');
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->isMergeModuleTest($root[0], $type[0])) && p() && e('1'); // 测试检查root 1 type bug 合并模块版本
|
||||
r($tree->isMergeModuleTest($root[1], $type[0])) && p() && e('1'); // 测试检查root 2 type bug 合并模块版本
|
||||
r($tree->isMergeModuleTest($root[2], $type[0])) && p() && e('1'); // 测试检查root 3 type bug 合并模块版本
|
||||
r($tree->isMergeModuleTest($root[0], $type[1])) && p() && e('1'); // 测试检查root 1 type case 合并模块版本
|
||||
r($tree->isMergeModuleTest($root[1], $type[1])) && p() && e('1'); // 测试检查root 2 type case 合并模块版本
|
||||
r($tree->isMergeModuleTest($root[2], $type[1])) && p() && e('1'); // 测试检查root 3 type case 合并模块版本
|
||||
r($tree->isMergeModuleTest($root[3], $type[2])) && p() && e('1'); // 测试检查root 101 type task 合并模块版本
|
||||
r($tree->isMergeModuleTest($root[4], $type[2])) && p() && e('1'); // 测试检查root 102 type task 合并模块版本
|
||||
r($tree->isMergeModuleTest($root[5], $type[2])) && p() && e('1'); // 测试检查root 103 type task 合并模块版本
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->manageChild();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$root = array(1, 41);
|
||||
$parentModuleID = array(1821, 2621, 1981, 1982);
|
||||
$branch = array(0, 0, 0, 0, 0);
|
||||
$type = 'story';
|
||||
|
||||
$modules1 = array('id2621' => '修改名称的产品子模块1', 'id2622' => '产品子模块2', '0' => '新建产品子模块1', '2' => '', '3' => '新建产品子模块2', '4' => '', '5' => '');
|
||||
$short1 = array('id2621' => '模块简称1', 'id2622' => '修改简称的模块简称2', '0' => '新建模块简称1', '2' => '新建模块简称3', '3' => '新建模块简称2', '4' => '', '5' => '');
|
||||
$order1 = array('id2621' => 10, 'id2622' => 20);
|
||||
$tree1 = array('maxOrder' => 20, 'parentModuleID' => $parentModuleID[0], 'modules' => $modules1, 'shorts' => $short1, 'order' => $order1);
|
||||
|
||||
$modules2 = array('0' => '新建产品子模块3', '2' => '', '3' => '新建产品子模块4', '4' => '', '5' => '');
|
||||
$short2 = array('0' => '新建模块简称3', '2' => '新建模块简称5', '3' => '新建模块简称4', '4' => '', '5' => '');
|
||||
$tree2 = array('maxOrder' => 20, 'parentModuleID' => $parentModuleID[1], 'modules' => $modules2, 'shorts' => $short2);
|
||||
|
||||
$modules3 = array('id2701' => '修改名称的产品子模块81', 'id2702' => '产品子模块82', '0' => '新建产品子模块5', '2' => '', '3' => '新建产品子模块6', '4' => '', '5' => '');
|
||||
$short3 = array('id2701' => '模块简称81', 'id2702' => '修改简称的模块简称82', '0' => '新建模块简称5', '2' => '新建模块简称7', '3' => '新建模块简称6', '4' => '', '5' => '');
|
||||
$order3 = array('id2701' => 10, 'id2702' => 20);
|
||||
$branch3 = array(0, 0, 0, 0, 0, 0);
|
||||
$tree3 = array('maxOrder' => 20, 'parentModuleID' => $parentModuleID[2], 'modules' => $modules3, 'shorts' => $short3, 'order' => $order3, 'branch' => $branch3);
|
||||
|
||||
$modules4 = array('0' => '新建产品子模块7', '2' => '', '3' => '新建产品子模块8', '4' => '', '5' => '');
|
||||
$short4 = array('0' => '新建模块简称7', '2' => '新建模块简称9', '3' => '新建模块简称8', '4' => '', '5' => '');
|
||||
$branch4 = array(1, 1, 1, 1, 1, 1);
|
||||
$tree4 = array('maxOrder' => 20, 'parentModuleID' => $parentModuleID[3], 'modules' => $modules4, 'shorts' => $short4, 'branch' => $branch4);
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->manageChildTest($root[0], $type, $tree1)) && p() && e(',修改名称的产品子模块1,产品子模块2,新建产品子模块1,新建产品子模块2'); // 测试管理module 1821 的子模块
|
||||
r($tree->manageChildTest($root[0], $type, $tree2)) && p() && e(',新建产品子模块3,新建产品子模块4'); // 测试管理module 2621 的子模块
|
||||
r($tree->manageChildTest($root[1], $type, $tree3)) && p() && e(',修改名称的产品子模块81,产品子模块82,新建产品子模块5,新建产品子模块6'); // 测试管理module 1981 的子模块
|
||||
r($tree->manageChildTest($root[1], $type, $tree4)) && p() && e(',新建产品子模块7,新建产品子模块8'); // 测试管理module 1982 的子模块
|
||||
system("./ztest init");
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->update();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$moduleID = array(1821, 1981);
|
||||
|
||||
$changeRoot = array('root' => '2');
|
||||
$changeParent = array('parent' => 1822);
|
||||
$changeName = array('name' => '修改后的模块名');
|
||||
$changeShort = array('short' => '修改后的简称');
|
||||
$changeBranch = array('branch' => 1);
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->updateTest($moduleID[0], $changeRoot)) && p('root,branch,parent,name,short') && e('2,0,0,产品模块1,模块简称1'); // 测试更新module 1821 的 root
|
||||
r($tree->updateTest($moduleID[0], $changeParent)) && p('root,branch,parent,name,short') && e('2,0,1822,产品模块1,模块简称1'); // 测试更新module 1821 的 root
|
||||
r($tree->updateTest($moduleID[0], $changeName)) && p('root,branch,parent,name,short') && e('2,0,1822,修改后的模块名,模块简称1'); // 测试更新module 1821 的 root
|
||||
r($tree->updateTest($moduleID[0], $changeShort)) && p('root,branch,parent,name,short') && e('2,0,1822,修改后的模块名,修改后的简称'); // 测试更新module 1821 的 root
|
||||
r($tree->updateTest($moduleID[1], $changeBranch)) && p('root,branch,parent,name,short') && e('41,1,0,产品模块161,模块简称161'); // 测试更新module 1981 的 root
|
||||
system("./ztest init");
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/tree.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 treeModel->updateOrder();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$orders1 = array('2221' => 0, '2821' => 1, '2822' => 2, '1822' => 3, '1823' => 4, '2222' => 5, '2223' => 6, '1824' => 7, '2224' => 8);
|
||||
$orders2 = array('2221' => 0, '2821' => 1, '2822' => 2, '1822' => 3, '1823' => 4, '1824' => 5, '2222' => 6, '2223' => 7, '2224' => 8);
|
||||
$orders3 = array('2221' => 0, '2822' => 1, '2821' => 2, '1822' => 3, '1823' => 4, '1824' => 5, '2222' => 6, '2223' => 7, '2224' => 8);
|
||||
$orders4 = array('1984' => 0, '2381' => 1, '2901' => 2, '2902' => 3, '2382' => 4, '2383' => 5, '2384' => 6);
|
||||
|
||||
$tree = new treeTest();
|
||||
|
||||
r($tree->updateOrderTest($orders1)) && p() && e(',2221,2821,1822,2822,1823,2222,2223,1824,2224'); // 测试更新模块顺序 1
|
||||
r($tree->updateOrderTest($orders2)) && p() && e(',2221,2821,1822,2822,1823,1824,2222,2223,2224'); // 测试更新模块顺序 2
|
||||
r($tree->updateOrderTest($orders3)) && p() && e(',2221,2822,1822,2821,1823,1824,2222,2223,2224'); // 测试更新模块顺序 3
|
||||
r($tree->updateOrderTest($orders4)) && p() && e(',1984,2901,2381,2902,2382,2383,2384'); // 测试更新模块顺序 4
|
||||
system("./ztest init");
|
||||
Reference in New Issue
Block a user