Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms into zentaopms_289
This commit is contained in:
@@ -222,7 +222,7 @@ function renderExecutionItem(item, $item)
|
||||
|
||||
if(!$title.length)
|
||||
{
|
||||
if((item.type == 'kanban' && window.userPrivs.kanban) || (item.type != 'kanban' && window.userPrivs.execution))
|
||||
if(!item.hasOwnProperty('children') && ((item.type == 'kanban' && window.userPrivs.kanban) || (item.type != 'kanban' && window.userPrivs.execution)))
|
||||
{
|
||||
var method = item.type == 'kanban' ? 'kanban' : 'task';
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ class cron extends control
|
||||
|
||||
if($now > $cron['time'])
|
||||
{
|
||||
if(!$this->cron->changeStatusRunning($id, $cronInfo->lastTime)) continue;
|
||||
if(!$this->cron->changeStatusRunning($id)) continue;
|
||||
$parsedCrons[$id]['time'] = $cron['cron']->getNextRunDate();
|
||||
|
||||
/* Execution command. */
|
||||
|
||||
@@ -506,9 +506,10 @@ class execution extends control
|
||||
|
||||
$execution = $this->commonAction($toExecution);
|
||||
$toExecution = $execution->id;
|
||||
$project = $this->loadModel('project')->getByID($execution->project);
|
||||
$branches = $this->execution->getBranches($toExecution);
|
||||
$tasks = $this->execution->getTasks2Imported($toExecution, $branches);
|
||||
$executions = $this->execution->getToImport(array_keys($tasks), $execution->type);
|
||||
$executions = $this->execution->getToImport(array_keys($tasks), $execution->type, $project->model);
|
||||
unset($executions[$toExecution]);
|
||||
unset($tasks[$toExecution]);
|
||||
|
||||
@@ -2812,7 +2813,7 @@ class execution extends control
|
||||
{
|
||||
$this->loadModel('project');
|
||||
$projects = $this->project->getPairsByProgram('', 'noclosed');
|
||||
$executions = $this->execution->getStatData(0, 'all', 0, 0, false, '', 'id_desc');
|
||||
$executions = $this->execution->getStatData(0, 'all', 0, 0, false, 'withchild', 'id_desc');
|
||||
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
@@ -4019,7 +4020,6 @@ class execution extends control
|
||||
$this->view->status = $status;
|
||||
$this->view->from = $from;
|
||||
$this->view->param = $param;
|
||||
$this->view->isStage = (isset($project->model) and $project->model == 'waterfall') ? true : false;
|
||||
$this->view->showBatchEdit = $this->cookie->showExecutionBatchEdit;
|
||||
|
||||
$this->display();
|
||||
|
||||
+27
-13
@@ -1019,7 +1019,6 @@ class executionModel extends model
|
||||
public function batchChangeStatus($executionIdList, $status)
|
||||
{
|
||||
$this->loadModel('programplan');
|
||||
$this->loadModel('action');
|
||||
|
||||
/* Sort the IDs, the child stage comes first, and the parent stage follows. */
|
||||
$executionIdList = $this->dao->select('id')->from(TABLE_EXECUTION)->where('id')->in($executionIdList)->orderBy('grade_desc')->fetchPairs();
|
||||
@@ -1068,6 +1067,9 @@ class executionModel extends model
|
||||
*/
|
||||
public function changeStatus2Wait($executionID, $selfAndChildren, $siblingStages)
|
||||
{
|
||||
$this->loadModel('programplan');
|
||||
$this->loadModel('action');
|
||||
|
||||
$parentID = $selfAndChildren[$executionID]->parent;
|
||||
|
||||
/* There are already tasks consuming work in this phase or its sub-phases already have start times. */
|
||||
@@ -1075,7 +1077,7 @@ class executionModel extends model
|
||||
$hasConsumedTasks = $this->dao->select('count(consumed) as count')->from(TABLE_TASK)->where('deleted')->eq(0)->andWhere('execution')->in(array_keys($selfAndChildren))->andWhere('consumed')->gt(0)->fetch('count');
|
||||
if($hasStartedChildren or $hasConsumedTasks) return "'{$selfAndChildren[$executionID]->name}',";
|
||||
|
||||
$newExecution = $this->buildExecutionBySstatus('wait');
|
||||
$newExecution = $this->buildExecutionByStatus('wait');
|
||||
$this->dao->update(TABLE_EXECUTION)->data($newExecution)->where('id')->eq($executionID)->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
@@ -1112,7 +1114,7 @@ class executionModel extends model
|
||||
$parentStatus = (!helper::isZeroDate($parent->realBegan) or $parentHasConsumedTasks) ? 'doing' : 'wait';
|
||||
if($parent->status == $parentStatus) return '';
|
||||
|
||||
$newParent = $this->buildExecutionBySstatus($parentStatus);
|
||||
$newParent = $this->buildExecutionByStatus($parentStatus);
|
||||
$this->dao->update(TABLE_EXECUTION)->data($newParent)->where('id')->eq($parentID)->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
@@ -1139,10 +1141,13 @@ class executionModel extends model
|
||||
*/
|
||||
public function changeStatus2Doing($executionID, $selfAndChildren)
|
||||
{
|
||||
$this->loadModel('programplan');
|
||||
$this->loadModel('action');
|
||||
|
||||
$type = $selfAndChildren[$executionID]->type;
|
||||
$parentID = $selfAndChildren[$executionID]->parent;
|
||||
|
||||
$newExecution = $this->buildExecutionBySstatus('doing');
|
||||
$newExecution = $this->buildExecutionByStatus('doing');
|
||||
$this->dao->update(TABLE_EXECUTION)->data($newExecution)->where('id')->eq($executionID)->exec();
|
||||
if(!dao::isError())
|
||||
{
|
||||
@@ -1159,7 +1164,7 @@ class executionModel extends model
|
||||
$parent = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($parentID)->fetch();
|
||||
if($parent->status == 'doing') return '';
|
||||
|
||||
$newParent = $this->buildExecutionBySstatus('doing');
|
||||
$newParent = $this->buildExecutionByStatus('doing');
|
||||
$this->dao->update(TABLE_EXECUTION)->data($newParent)->where('id')->eq($parentID)->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
@@ -1186,6 +1191,9 @@ class executionModel extends model
|
||||
*/
|
||||
public function changeStatus2Inactived($executionID, $status, $selfAndChildren, $siblingStages)
|
||||
{
|
||||
$this->loadModel('programplan');
|
||||
$this->loadModel('action');
|
||||
|
||||
$type = $selfAndChildren[$executionID]->type;
|
||||
$parentID = $selfAndChildren[$executionID]->parent;
|
||||
$checkedStatus = $status == 'suspended' ? 'wait,doing' : 'wait,doing,suspended';
|
||||
@@ -1203,7 +1211,7 @@ class executionModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
$newExecution = $this->buildExecutionBySstatus($status);
|
||||
$newExecution = $this->buildExecutionByStatus($status);
|
||||
$this->dao->update(TABLE_EXECUTION)->data($newExecution)->where('id')->eq($executionID)->exec();
|
||||
if(!dao::isError())
|
||||
{
|
||||
@@ -1235,7 +1243,7 @@ class executionModel extends model
|
||||
$parent = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($parentID)->fetch();
|
||||
if($parent->status == $status) return '';
|
||||
|
||||
$newParent = $this->buildExecutionBySstatus($status);
|
||||
$newParent = $this->buildExecutionByStatus($status);
|
||||
$this->dao->update(TABLE_EXECUTION)->data($newParent)->where('id')->eq($parentID)->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
@@ -1248,7 +1256,6 @@ class executionModel extends model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2042,7 +2049,11 @@ class executionModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
foreach($childList as $childID) unset($executions[$childID]);
|
||||
if(strpos($param, 'withchild') === false)
|
||||
{
|
||||
foreach($childList as $childID) unset($executions[$childID]);
|
||||
}
|
||||
|
||||
foreach($parentList as $parentID) unset($executions[$parentID]);
|
||||
|
||||
return array_values($executions);
|
||||
@@ -2795,17 +2806,19 @@ class executionModel extends model
|
||||
* Get executions to import
|
||||
*
|
||||
* @param array $executionIds
|
||||
* @param string $type sprint|stage
|
||||
* @param string $type sprint|stage|kanban
|
||||
* @param string $model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getToImport($executionIds, $type)
|
||||
public function getToImport($executionIds, $type, $model = '')
|
||||
{
|
||||
return $this->dao->select('t1.id,concat_ws(" / ", t2.name, t1.name) as name')->from(TABLE_EXECUTION)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t2.id=t1.project')
|
||||
->where('t1.id')->in($executionIds)
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi()
|
||||
->andWhere('t1.type')->eq($type)
|
||||
->beginIF(empty($model) or strpos(',waterfallplus,agileplus,', ",$model,") === false)->andWhere('t1.type')->eq($type)->fi()
|
||||
->beginIF(!empty($model) and $model == 'agileplus')->andWhere('t1.type')->in(array('sprint', 'kanban'))->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy('t1.id desc')
|
||||
->fetchPairs('id', 'name');
|
||||
@@ -2890,6 +2903,7 @@ class executionModel extends model
|
||||
->where('project')->in($brotherProjects)
|
||||
->andWhere('multiple')->eq('1')
|
||||
->andWhere('status')->ne('closed')
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs('id');
|
||||
|
||||
$branches = str_replace(',', "','", $branches);
|
||||
@@ -5908,7 +5922,7 @@ class executionModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function buildExecutionBySstatus($status)
|
||||
public function buildExecutionByStatus($status)
|
||||
{
|
||||
$execution = new stdclass();
|
||||
$execution->status = $status;
|
||||
|
||||
@@ -1581,7 +1581,7 @@ class programplanModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Change whether it is the top stage.
|
||||
* Check whether it is the top stage.
|
||||
*
|
||||
* @param int $planID
|
||||
* @access public
|
||||
@@ -1600,23 +1600,22 @@ class programplanModel extends model
|
||||
*
|
||||
* @param int $planID
|
||||
* @param string $attribute
|
||||
* @param bool $withDeleted
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function updateSubStageAttr($planID, $attribute, $withDeleted = false)
|
||||
public function updateSubStageAttr($planID, $attribute)
|
||||
{
|
||||
if($attribute == 'mix') return true;
|
||||
|
||||
$subStageList = $this->dao->select('id')->from(TABLE_EXECUTION)
|
||||
->where('parent')->eq($planID)
|
||||
->beginIF(!$withDeleted)->andWhere('deleted')->eq(0)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
$this->dao->update(TABLE_EXECUTION)->set('attribute')->eq($attribute)->where('id')->in(array_keys($subStageList))->exec();
|
||||
|
||||
foreach($subStageList as $childID => $subStage)
|
||||
{
|
||||
$this->updateSubStageAttr($childID, $attribute, $withDeleted);
|
||||
$this->updateSubStageAttr($childID, $attribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -548,7 +548,7 @@ class testcase extends control
|
||||
$modules = $this->tree->getAllChildID($modules);
|
||||
}
|
||||
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch, $modules, 'active', 'id_desc', 50, 'full', 'story', false);
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch, $modules, 'all', 'id_desc', 50, 'full', 'story', false);
|
||||
if($this->app->tab != 'qa' and $this->app->tab != 'product')
|
||||
{
|
||||
$projectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution;
|
||||
@@ -997,7 +997,6 @@ class testcase extends control
|
||||
$moduleIdList = $case->module;
|
||||
if($case->module) $moduleIdList = $this->tree->getAllChildID($case->module);
|
||||
|
||||
$moduleIdList = (!in_array($this->app->tab, array('execution', 'project')) and empty($stories)) ? 0 : $moduleIdList;
|
||||
if($this->app->tab == 'execution')
|
||||
{
|
||||
$stories = $this->story->getExecutionStoryPairs($case->execution, $productID, $case->branch, $moduleIdList);
|
||||
|
||||
@@ -131,7 +131,7 @@ function setStories()
|
||||
productID = $('#product').val();
|
||||
branch = $('#branch').val();
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=0&type=full&hasParent=1&executionID=' + executionID);
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=all&limit=0&type=full&hasParent=1&executionID=' + executionID);
|
||||
|
||||
$.get(link, function(stories)
|
||||
{
|
||||
|
||||
@@ -567,4 +567,24 @@ class actionTest
|
||||
foreach($objects as $object) $count += count($object);
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test restore stages.
|
||||
*
|
||||
* @param array $stageList
|
||||
* @param array $actionIdList
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function restoreStagesTest($stageList, $actionIdList)
|
||||
{
|
||||
$this->objectModel->restoreStages($stageList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$actionList = array();
|
||||
foreach($actionIdList as $actionID) $actionList[$actionID] = $this->objectModel->getByID($actionID);
|
||||
|
||||
return $actionList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,13 +77,12 @@ class cronTest
|
||||
* Change cron status to running test.
|
||||
*
|
||||
* @param int $cronID
|
||||
* @param string $lastTime
|
||||
* @access public
|
||||
* @return bool|int
|
||||
*/
|
||||
public function changeStatusRunningTest($cronID, $lastTime)
|
||||
public function changeStatusRunningTest($cronID)
|
||||
{
|
||||
$objects = $this->objectModel->changeStatusRunning($cronID, $lastTime);
|
||||
$objects = $this->objectModel->changeStatusRunning($cronID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
|
||||
@@ -321,6 +321,127 @@ class executionTest
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function batchChangeStatus test by execution
|
||||
*
|
||||
* @param array $executionIdList
|
||||
* @param string $status
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchChangeStatusObject($executionIdList = '', $status = '')
|
||||
{
|
||||
$result = $this->executionModel->batchChangeStatus($executionIdList, $status);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
return empty($result) ? 'empty' : $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function changeStatus2Wait test by execution
|
||||
*
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return string|array
|
||||
*/
|
||||
public function changeStatus2WaitObject($executionID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$tester->loadModel('programplan');
|
||||
$selfAndChildrenList = $tester->programplan->getSelfAndChildrenList($executionID);
|
||||
$siblingStages = $tester->programplan->getSiblings($executionID);
|
||||
|
||||
$selfAndChildren = $selfAndChildrenList[$executionID];
|
||||
$execution = $selfAndChildren[$executionID];
|
||||
$executionType = $execution->type;
|
||||
|
||||
$siblingList = array();
|
||||
if($executionType == 'stage') $siblingList = $siblingStages[$executionID];
|
||||
|
||||
$result = $this->executionModel->changeStatus2Wait($executionID, $selfAndChildren, $siblingList);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
return (empty($result) or $result == "'',") ? 'empty' : $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function changeStatus2Doing test by execution
|
||||
*
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return bool|array
|
||||
*/
|
||||
public function changeStatus2DoingObject($executionID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$tester->loadModel('programplan');
|
||||
$selfAndChildrenList = $tester->programplan->getSelfAndChildrenList($executionID);
|
||||
|
||||
$selfAndChildren = $selfAndChildrenList[$executionID];
|
||||
$execution = $selfAndChildren[$executionID];
|
||||
$executionType = $execution->type;
|
||||
|
||||
$this->executionModel->changeStatus2Doing($executionID, $selfAndChildren);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function changeStatus2Inactived test by execution
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $status suspended|closed
|
||||
* @access public
|
||||
* @return bool|array
|
||||
*/
|
||||
public function changeStatus2InactivedObject($executionID, $status)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$tester->loadModel('programplan');
|
||||
$selfAndChildrenList = $tester->programplan->getSelfAndChildrenList($executionID);
|
||||
$siblingStages = $tester->programplan->getSiblings($executionID);
|
||||
|
||||
$selfAndChildren = $selfAndChildrenList[$executionID];
|
||||
$execution = $selfAndChildren[$executionID];
|
||||
$executionType = $execution->type;
|
||||
|
||||
$siblingList = array();
|
||||
if($executionType == 'stage') $siblingList = $siblingStages[$executionID];
|
||||
|
||||
$result = $this->executionModel->changeStatus2Inactived($executionID, $status, $selfAndChildren, $siblingList);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
return (empty($result) or $result == "'',") ? 'empty' : $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function start test by execution
|
||||
*
|
||||
@@ -2807,6 +2928,18 @@ class executionTest
|
||||
->orderBy('date DESC, id asc')->fetchGroup('name', 'date');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build execution object by status.
|
||||
*
|
||||
* @param string $status
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function buildExecutionByStatusTest($status)
|
||||
{
|
||||
return $this->executionModel->buildExecutionByStatus($status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset execution sorts.
|
||||
*
|
||||
|
||||
@@ -385,4 +385,90 @@ class programplanTest
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check if the stage is a leaf stage.
|
||||
*
|
||||
* @param int $planID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function checkLeafStageTest($planID)
|
||||
{
|
||||
$objects = $this->objectModel->checkLeafStage($planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check whether it is the top stage.
|
||||
*
|
||||
* @param int $planID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function checkTopStageTest($planID)
|
||||
{
|
||||
$objects = $this->objectModel->checkTopStage($planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update sub-stage attribute.
|
||||
*
|
||||
* @param int $planID
|
||||
* @param string $attribute
|
||||
* @param int $subStageID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function updateSubStageAttrTest($planID, $attribute, $subStageID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$objects = $this->objectModel->updateSubStageAttr($planID, $attribute);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$attribute = $tester->dao->select('attribute')->from(TABLE_EXECUTION)->where('id')->eq($subStageID)->fetch('attribute');
|
||||
|
||||
return $attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get plan and its children.
|
||||
*
|
||||
* @param string|int|array $executionIdList
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSelfAndChildrenListTest($executionIdList)
|
||||
{
|
||||
$objects = $this->objectModel->getSelfAndChildrenList($executionIdList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get plan's siblings.
|
||||
*
|
||||
* @param string|int|array $executionIdList
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSiblingsTest($executionIdList)
|
||||
{
|
||||
$objects = $this->objectModel->getSiblings($executionIdList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/action.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$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->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->deleted->range('0,1{4}');
|
||||
$execution->gen(5);
|
||||
|
||||
$action = zdTable('action');
|
||||
$action->id->range('1-4');
|
||||
$action->objectType->range('execution');
|
||||
$action->objectID->range('2,3,4,5');
|
||||
$action->project->range('1');
|
||||
$action->actor->range('admin');
|
||||
$action->action->range('deleted');
|
||||
$action->extra->range('1');
|
||||
$action->gen(4);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->restoreStages();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试还原id为2和3的阶段 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
$hasDeleted = $action->restoreStagesTest(array(2 => 2, 3 => 3), array(1, 2));
|
||||
|
||||
r($hasDeleted[2]) && p('extra') && e('0'); // 测试还原id为2和3的阶段
|
||||
@@ -18,8 +18,7 @@ pid=1
|
||||
|
||||
$cron = new cronTest();
|
||||
$cronID = 4;
|
||||
$lastTime = '0000-00-00 00:00:00';
|
||||
$result = $cron->changeStatusRunningTest($cronID, $lastTime);
|
||||
$result = $cron->changeStatusRunningTest($cronID);
|
||||
$cronInfo = $tester->cron->getById($cronID);
|
||||
|
||||
r($result) && p() && e('1'); // 更新之后查看返回值是否是1
|
||||
|
||||
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/execution.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('wait{5}');
|
||||
$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);
|
||||
|
||||
/**
|
||||
|
||||
title=测试executionModel->batchChangeStatus();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试批量修改执行状态为进行中 >> empty
|
||||
测试批量修改执行状态为未开始 >> empty
|
||||
测试批量修改执行状态为已挂起 >> empty
|
||||
测试批量修改执行状态为已关闭 >> 阶段a子1
|
||||
|
||||
*/
|
||||
|
||||
$execution = new executionTest();
|
||||
r($execution->batchChangeStatusObject(array(4), 'doing')) && p('') && e('empty'); // 测试批量修改执行状态为进行中
|
||||
r($execution->batchChangeStatusObject(array(2), 'wait')) && p('') && e('empty'); // 测试批量修改执行状态为未开始
|
||||
r($execution->batchChangeStatusObject(array(5), 'suspended')) && p('') && e('empty'); // 测试批量修改执行状态为已挂起
|
||||
r($execution->batchChangeStatusObject(array(3), 'closed')) && p('') && e('阶段a子1'); // 测试批量修改执行状态为已关闭
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
#!/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');
|
||||
|
||||
/**
|
||||
|
||||
title=测试executionModel->buildExecutionByStatus();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试传入未开始状态,返回对象的实际开始时间 >> 0
|
||||
测试传入进行中状态,返回对象的状态 >> doing
|
||||
测试传入已挂起状态,返回对象的状态 >> suspended
|
||||
测试传入已关闭状态,返回对象的由谁关闭 >> admin
|
||||
|
||||
*/
|
||||
|
||||
$execution = new executionTest();
|
||||
$waitObject = $execution->buildExecutionByStatusTest('wait');
|
||||
r($waitObject->realBegan) && p('') && e('0'); // 测试传入未开始状态,返回对象的实际开始时间
|
||||
r($execution->buildExecutionByStatusTest('doing')) && p('status') && e("doing"); // 测试传入进行中状态,返回对象的状态
|
||||
r($execution->buildExecutionByStatusTest('suspended')) && p('status') && e('suspended'); // 测试传入已挂起状态,返回对象的状态
|
||||
r($execution->buildExecutionByStatusTest('closed')) && p('closedBy') && e('admin'); // 测试传入已关闭状态,返回对象的由谁关闭
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/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,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$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->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试executionModel->changeStatus2Doing();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试修改顶级父阶段执行状态为进行中 >> 1
|
||||
测试修改子阶段执行状态为进行中 >> 1
|
||||
测试修改叶子阶段执行状态为进行中 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$execution = new executionTest();
|
||||
r($execution->changeStatus2DoingObject(2)) && p('') && e('1'); // 测试修改顶级父阶段执行状态为进行中
|
||||
r($execution->changeStatus2DoingObject(3)) && p('') && e('1'); // 测试修改子阶段执行状态为进行中
|
||||
r($execution->changeStatus2DoingObject(4)) && p('') && e('1'); // 测试修改叶子阶段执行状态为进行中
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#!/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,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$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->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试executionModel->changeStatus2Inactived();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试修改顶级父阶段执行状态为已挂起 >> '阶段a',
|
||||
测试修改子阶段执行状态为已关闭 >> empty
|
||||
测试修改叶子阶段执行状态为已关闭 >> empty
|
||||
|
||||
*/
|
||||
|
||||
$execution = new executionTest();
|
||||
r($execution->changeStatus2InactivedObject(2, 'suspended')) && p('') && e("'阶段a',"); // 测试修改顶级父阶段执行状态为已挂起
|
||||
r($execution->changeStatus2InactivedObject(3, 'closed')) && p('') && e("empty"); // 测试修改子阶段执行状态为已关闭
|
||||
r($execution->changeStatus2InactivedObject(4, 'closed')) && p('') && e('empty'); // 测试修改叶子阶段执行状态为已关闭
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/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,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$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->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试executionModel->changeStatus2Wait();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试修改顶级父阶段执行状态为未开始 >> '阶段a',
|
||||
测试修改子阶段执行状态为未开始 >> '阶段a子1',
|
||||
测试修改叶子阶段执行状态为未开始 >> empty
|
||||
|
||||
*/
|
||||
|
||||
$execution = new executionTest();
|
||||
r($execution->changeStatus2WaitObject(2)) && p('') && e("'阶段a',"); // 测试修改顶级父阶段执行状态为未开始
|
||||
r($execution->changeStatus2WaitObject(3)) && p('') && e("'阶段a子1',"); // 测试修改子阶段执行状态为未开始
|
||||
r($execution->changeStatus2WaitObject(4)) && p('') && e('empty'); // 测试修改叶子阶段执行状态为未开始
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/programplan.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$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->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试programplanModel->checkLeafStage();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试id为2判断是否为叶子节点 >> 0
|
||||
测试id为5判断是否为叶子节点 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$plan = new programplanTest();
|
||||
|
||||
r($plan->checkLeafStageTest(2)) && p('') && e(0); // 测试id为2判断是否为叶子节点
|
||||
r($plan->checkLeafStageTest(5)) && p('') && e(1); // 测试id为5判断是否为叶子节点
|
||||
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/programplan.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$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->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试programplanModel->checkTopStage();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试id为2判断是否为顶级阶段 >> 1
|
||||
测试id为4判断是否为顶级阶段 >> 0
|
||||
测试id为5判断是否为顶级阶段 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$plan = new programplanTest();
|
||||
|
||||
r($plan->checkTopStageTest(2)) && p('') && e(1); // 测试id为2判断是否为顶级阶段
|
||||
r($plan->checkTopStageTest(4)) && p('') && e(0); // 测试id为4判断是否为顶级阶段
|
||||
r($plan->checkTopStageTest(5)) && p('') && e(1); // 测试id为5判断是否为顶级阶段
|
||||
@@ -37,16 +37,12 @@ $parentIDList = array(1, 2, 3, 4);
|
||||
$programplan = new programplanTest();
|
||||
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[0])) && p('stage') && e('stage'); // 查找父ID为 1 未删除的阶段类型 stage
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[0])) && p('sprint') && e(''); // 查找父ID为 1 未删除的阶段类型 sprint
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[0])) && p('kanban') && e('kanban'); // 查找父ID为 1 未删除的阶段类型 kanban
|
||||
r(count($programplan->getParentChildrenTypesTest($parentIDList[0]))) && p() && e('2'); // 查找父ID为 1 未删除的阶段类型数量
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[1])) && p('stage') && e(''); // 查找父ID为 2 未删除的阶段类型 stage
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[1])) && p('sprint') && e('sprint'); // 查找父ID为 2 未删除的阶段类型 sprint
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[1])) && p('kanban') && e(''); // 查找父ID为 2 未删除的阶段类型 kanban
|
||||
r(count($programplan->getParentChildrenTypesTest($parentIDList[1]))) && p() && e('1'); // 查找父ID为 2 未删除的阶段类型数量
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[2])) && p('stage') && e('stage'); // 查找父ID为 3 未删除的阶段类型 stage
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[2])) && p('sprint') && e('sprint'); // 查找父ID为 3 未删除的阶段类型 sprint
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[2])) && p('kanban') && e(''); // 查找父ID为 3 未删除的阶段类型 kanban
|
||||
r(count($programplan->getParentChildrenTypesTest($parentIDList[2]))) && p() && e('2'); // 查找父ID为 3 未删除的阶段类型数量
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[3])) && p('stage') && e('0'); // 查找父ID为 1 未删除的阶段类型 stage
|
||||
r($programplan->getParentChildrenTypesTest($parentIDList[3])) && p('sprint') && e('0'); // 查找父ID为 1 未删除的阶段类型 sprint
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/programplan.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$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->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试programplanModel->getSelfAndChildrenList();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试id为2时获取自己的状态 >> doing
|
||||
测试id为2时获取自己某一个后代的状态 >> 2
|
||||
|
||||
*/
|
||||
|
||||
$plan = new programplanTest();
|
||||
$topPlan = $plan->getSelfAndChildrenListTest(2);
|
||||
$topPlanCount = count($topPlan[2]);
|
||||
|
||||
r($topPlan[2][2]) && p('status') && e('doing'); // 测试id为2时获取自己的状态
|
||||
r($topPlanCount - 1) && p('') && e(2); // 测试id为2时获取自己后代的个数
|
||||
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/programplan.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$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->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试programplanModel->getSiblings();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试id为2时获取兄弟阶段的的名称 >> 阶段b
|
||||
测试id为2时获取自己兄弟阶段的个数 >> 1
|
||||
测试id为4时获取自己兄弟阶段的个数 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$plan = new programplanTest();
|
||||
$topPlan = $plan->getSiblingsTest(2);
|
||||
$topPlanCount = count($topPlan[2]);
|
||||
|
||||
$leafPlan = $plan->getSiblingsTest(4);
|
||||
$leafPlanCount = count($leafPlan[4]);
|
||||
|
||||
r($topPlan[2][5]) && p('name') && e('阶段b'); // 测试id为2时获取兄弟阶段的的名称
|
||||
r($topPlanCount - 1) && p('') && e(1); // 测试id为2时获取自己兄弟阶段的个数
|
||||
r($leafPlanCount - 1) && p('') && e(0); // 测试id为4时获取自己兄弟阶段的个数
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/programplan.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$execution->attribute->range(" ,mix,request,request,review");
|
||||
$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->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试programplanModel->updateSubStageAttr();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试更改id为3的阶段为综合 >> request
|
||||
测试更改id为2的阶段为设计 >> design
|
||||
|
||||
*/
|
||||
|
||||
$plan = new programplanTest();
|
||||
|
||||
r($plan->updateSubStageAttrTest(3, 'mix', 4)) && p('') && e('request'); // 测试更改id为3的阶段为综合
|
||||
r($plan->updateSubStageAttrTest(2, 'design', 3)) && p('') && e('design'); // 测试更改id为2的阶段为设计
|
||||
@@ -18,7 +18,7 @@ pid=1
|
||||
测试批量创建瀑布项目的阶段 4 >> 7
|
||||
测试批量创建瀑布项目的百分比为空的阶段 >> 『工作量占比』不能为空。
|
||||
测试批量创建瀑布项目的类型为空的阶段 >> 『阶段类型』不能为空。
|
||||
测试批量创建瀑布项目的百分比非法的阶段 >> 工作量占比应当是数字,可以是小数。
|
||||
测试批量创建瀑布项目的百分比非法的阶段 >> 『工作量占比』应当是数字,可以是小数。
|
||||
测试批量创建瀑布项目的百分比超出100的阶段 >> 工作量占比累计不应当超过100%
|
||||
测试批量创建融合瀑布项目的阶段 1 >> 2
|
||||
测试批量创建融合瀑布项目的阶段 2 >> 4
|
||||
@@ -26,7 +26,7 @@ pid=1
|
||||
测试批量创建融合瀑布项目的阶段 4 >> 7
|
||||
测试批量创建融合瀑布项目的百分比为空的阶段 >> 『工作量占比』不能为空。
|
||||
测试批量创建融合瀑布项目的类型为空的阶段 >> 『阶段类型』不能为空。
|
||||
测试批量创建融合瀑布项目的百分比非法的阶段 >> 工作量占比应当是数字,可以是小数。
|
||||
测试批量创建融合瀑布项目的百分比非法的阶段 >> 『工作量占比』应当是数字,可以是小数。
|
||||
测试批量创建融合瀑布项目的百分比超出100的阶段 >> 工作量占比累计不应当超过100%
|
||||
|
||||
*/
|
||||
@@ -64,19 +64,19 @@ $param8 = array('name' => $name1, 'percent' => $percentOver, 'type' => $ty
|
||||
|
||||
$stage = new stageTest();
|
||||
|
||||
r($stage->batchCreateTest($param1)) && p() && e('2'); // 测试批量创建瀑布项目的阶段 1
|
||||
r($stage->batchCreateTest($param2)) && p() && e('4'); // 测试批量创建瀑布项目的阶段 2
|
||||
r($stage->batchCreateTest($param3)) && p() && e('6'); // 测试批量创建瀑布项目的阶段 3
|
||||
r($stage->batchCreateTest($param4)) && p() && e('7'); // 测试批量创建瀑布项目的阶段 4
|
||||
r($stage->batchCreateTest($param5)) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试批量创建瀑布项目的百分比为空的阶段
|
||||
r($stage->batchCreateTest($param6)) && p('type:0') && e('『阶段类型』不能为空。'); // 测试批量创建瀑布项目的类型为空的阶段
|
||||
r($stage->batchCreateTest($param7)) && p('percent:0') && e('工作量占比应当是数字,可以是小数。'); // 测试批量创建瀑布项目的百分比非法的阶段
|
||||
r($stage->batchCreateTest($param8)) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试批量创建瀑布项目的百分比超出100的阶段
|
||||
r($stage->batchCreateTest($param1, 'waterfallplus')) && p() && e('2'); // 测试批量创建融合瀑布项目的阶段 1
|
||||
r($stage->batchCreateTest($param2, 'waterfallplus')) && p() && e('4'); // 测试批量创建融合瀑布项目的阶段 2
|
||||
r($stage->batchCreateTest($param3, 'waterfallplus')) && p() && e('6'); // 测试批量创建融合瀑布项目的阶段 3
|
||||
r($stage->batchCreateTest($param4, 'waterfallplus')) && p() && e('7'); // 测试批量创建融合瀑布项目的阶段 4
|
||||
r($stage->batchCreateTest($param5, 'waterfallplus')) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试批量创建融合瀑布项目的百分比为空的阶段
|
||||
r($stage->batchCreateTest($param6, 'waterfallplus')) && p('type:0') && e('『阶段类型』不能为空。'); // 测试批量创建融合瀑布项目的类型为空的阶段
|
||||
r($stage->batchCreateTest($param7, 'waterfallplus')) && p('percent:0') && e('工作量占比应当是数字,可以是小数。'); // 测试批量创建融合瀑布项目的百分比非法的阶段
|
||||
r($stage->batchCreateTest($param8, 'waterfallplus')) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试批量创建融合瀑布项目的百分比超出100的阶段
|
||||
r($stage->batchCreateTest($param1)) && p() && e('2'); // 测试批量创建瀑布项目的阶段 1
|
||||
r($stage->batchCreateTest($param2)) && p() && e('4'); // 测试批量创建瀑布项目的阶段 2
|
||||
r($stage->batchCreateTest($param3)) && p() && e('6'); // 测试批量创建瀑布项目的阶段 3
|
||||
r($stage->batchCreateTest($param4)) && p() && e('7'); // 测试批量创建瀑布项目的阶段 4
|
||||
r($stage->batchCreateTest($param5)) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试批量创建瀑布项目的百分比为空的阶段
|
||||
r($stage->batchCreateTest($param6)) && p('type:0') && e('『阶段类型』不能为空。'); // 测试批量创建瀑布项目的类型为空的阶段
|
||||
r($stage->batchCreateTest($param7)) && p('percent:0') && e('『工作量占比』应当是数字,可以是小数。'); // 测试批量创建瀑布项目的百分比非法的阶段
|
||||
r($stage->batchCreateTest($param8)) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试批量创建瀑布项目的百分比超出100的阶段
|
||||
r($stage->batchCreateTest($param1, 'waterfallplus')) && p() && e('2'); // 测试批量创建融合瀑布项目的阶段 1
|
||||
r($stage->batchCreateTest($param2, 'waterfallplus')) && p() && e('4'); // 测试批量创建融合瀑布项目的阶段 2
|
||||
r($stage->batchCreateTest($param3, 'waterfallplus')) && p() && e('6'); // 测试批量创建融合瀑布项目的阶段 3
|
||||
r($stage->batchCreateTest($param4, 'waterfallplus')) && p() && e('7'); // 测试批量创建融合瀑布项目的阶段 4
|
||||
r($stage->batchCreateTest($param5, 'waterfallplus')) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试批量创建融合瀑布项目的百分比为空的阶段
|
||||
r($stage->batchCreateTest($param6, 'waterfallplus')) && p('type:0') && e('『阶段类型』不能为空。'); // 测试批量创建融合瀑布项目的类型为空的阶段
|
||||
r($stage->batchCreateTest($param7, 'waterfallplus')) && p('percent:0') && e('『工作量占比』应当是数字,可以是小数。'); // 测试批量创建融合瀑布项目的百分比非法的阶段
|
||||
r($stage->batchCreateTest($param8, 'waterfallplus')) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试批量创建融合瀑布项目的百分比超出100的阶段
|
||||
|
||||
@@ -19,6 +19,8 @@ pid=1
|
||||
|
||||
*/
|
||||
|
||||
zdTable('stage')->gen(10);
|
||||
|
||||
$stage = new stageTest();
|
||||
|
||||
r($stage->getStagesTest()) && p('1:name,percent,type') && e('需求,10,request'); // 测试获取阶段 1
|
||||
@@ -26,4 +28,4 @@ r($stage->getStagesTest()) && p('2:name,percent,type') && e('设计,10,design');
|
||||
r($stage->getStagesTest()) && p('3:name,percent,type') && e('开发,50,dev'); // 测试获取阶段 3
|
||||
r($stage->getStagesTest()) && p('4:name,percent,type') && e('测试,15,qa'); // 测试获取阶段 4
|
||||
r($stage->getStagesTest()) && p('5:name,percent,type') && e('发布,10,release'); // 测试获取阶段 5
|
||||
r($stage->getStagesTest()) && p('6:name,percent,type') && e('总结评审,5,review'); // 测试获取阶段 6
|
||||
r($stage->getStagesTest()) && p('6:name,percent,type') && e('总结评审,5,review'); // 测试获取阶段 6
|
||||
|
||||
+27
-7
@@ -112,7 +112,8 @@ class prepareUpdate
|
||||
$stories = array_filter(explode(',', trim($release->stories, ',')));
|
||||
$bugs = array_filter(explode(',', trim($release->bugs, ',')));
|
||||
|
||||
if(!empty($stories)) $doneStories .= $title[$product] . "\n";
|
||||
if(!empty($stories)) $doneStories .= $title[$product] . "\n";
|
||||
if(!empty($fixedBugs)) $fixedBugs .= $title[$product] . "\n";
|
||||
foreach($stories as $storyID)
|
||||
{
|
||||
$storyTitle = $this->getStoryOrBugTitle('story', $storyID);
|
||||
@@ -288,7 +289,14 @@ class prepareUpdate
|
||||
*/
|
||||
public function addConfirmedSql()
|
||||
{
|
||||
`sed -i "s/ \/\/ confirm insert position\.$/\\n case '{$this->internalZT->lastPmsVersionAB}':\\n \\\$confirmContent .= file_get_contents(\\\$this->getUpgradeFile('{$this->internalZT->lastPmsVersion}')); \/\/ confirm insert position\./" ../module/upgrade/model.php`;
|
||||
if(file_exists("../db/update{$this->internalZT->lastPmsVersion}.sql"))
|
||||
{
|
||||
`sed -i "s/ \/\/ confirm insert position\.$/\\n case '{$this->internalZT->lastPmsVersionAB}':\\n \\\$confirmContent .= file_get_contents(\\\$this->getUpgradeFile('{$this->internalZT->lastPmsVersion}')); \/\/ confirm insert position\./" ../module/upgrade/model.php`;
|
||||
}
|
||||
else
|
||||
{
|
||||
`sed -i "s/ \/\/ confirm insert position\.$/\\n case '{$this->internalZT->lastPmsVersionAB}': \/\/ confirm insert position\./" ../module/upgrade/model.php`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,13 +307,20 @@ class prepareUpdate
|
||||
*/
|
||||
public function exportStandardSql()
|
||||
{
|
||||
$updateSqlFile = "../db/update{$this->internalZT->lastPmsVersion}.sql";
|
||||
if(!file_exists($updateSqlFile))
|
||||
{
|
||||
`cp ../db/standard/zentao{$this->internalZT->lastPmsVersion}.sql ../db/standard/zentao{$this->internalZT->pmsVersion}.sql`;
|
||||
return true;
|
||||
}
|
||||
|
||||
$lastStandardSql = file_get_contents("../db/standard/zentao{$this->internalZT->lastPmsVersion}.sql");
|
||||
$tmpStandardSql = file_put_contents("/tmp/lastStandard.sql", "SET @@sql_mode='';\n$lastStandardSql");
|
||||
file_put_contents("/tmp/lastStandard.sql", "SET @@sql_mode='';\n$lastStandardSql");
|
||||
|
||||
`mysql -u{$this->mysqlConfig->account} -p{$this->mysqlConfig->password} -e "DROP DATABASE IF EXISTS {$this->mysqlConfig->databaseName}"`;
|
||||
`mysql -u{$this->mysqlConfig->account} -p{$this->mysqlConfig->password} -e "CREATE DATABASE IF NOT EXISTS {$this->mysqlConfig->databaseName}"`;
|
||||
`mysql -u{$this->mysqlConfig->account} -p{$this->mysqlConfig->password} -D {$this->mysqlConfig->databaseName} < /tmp/lastStandard.sql`;
|
||||
`mysql -u{$this->mysqlConfig->account} -p{$this->mysqlConfig->password} -D {$this->mysqlConfig->databaseName} < ../db/update{$this->internalZT->lastPmsVersion}.sql`;
|
||||
`mysql -u{$this->mysqlConfig->account} -p{$this->mysqlConfig->password} -D {$this->mysqlConfig->databaseName} < $updateSqlFile`;
|
||||
|
||||
`mysqldump -u{$this->mysqlConfig->account} -p{$this->mysqlConfig->password} --compact --no-data {$this->mysqlConfig->databaseName} > ../db/standard/zentao{$this->internalZT->pmsVersion}.sql`;
|
||||
|
||||
@@ -322,7 +337,10 @@ class prepareUpdate
|
||||
*/
|
||||
public function checkInstallSql()
|
||||
{
|
||||
$updateSql = file_get_contents("../db/update{$this->internalZT->lastPmsVersion}.sql");
|
||||
$updateSqlFile = "../db/update{$this->internalZT->lastPmsVersion}.sql";
|
||||
if(!file_exists($updateSqlFile)) return true;
|
||||
|
||||
$updateSql = file_get_contents($updateSqlFile);
|
||||
$sqlList = explode(';', $updateSql);
|
||||
$errorSql = '';
|
||||
|
||||
@@ -350,14 +368,16 @@ class prepareUpdate
|
||||
/* Alter table sql. */
|
||||
foreach(explode(',', $sql) as $option)
|
||||
{
|
||||
$option = preg_replace('/ AFTER `.*`/', '', $option);
|
||||
$option = trim($option, ';');
|
||||
if(stripos($option, 'ADD ') !== false or stripos($option, 'MODIFY ') !== false)
|
||||
{
|
||||
preg_match("/(ADD|MODIFY) (COLUMN )*(`(.*?)`) (.*)/i", $option, $matches);
|
||||
preg_match("/(ADD|MODIFY) (COLUMN )*((`(.*?)`) (.*)?)/i", $option, $matches);
|
||||
if(strpos($createTableSql, $matches[3]) === false) $errorSql .= $option . "\n";
|
||||
}
|
||||
if(stripos($option, 'CHANGE ') !== false)
|
||||
{
|
||||
preg_match("/CHANGE (COLUMN )*(`(.*?)`) (`(.*?)`) (.*)/i", $option, $matches);
|
||||
preg_match("/CHANGE (COLUMN )*(`(.*?)`) ((`(.*?)`) (.*)?)/i", $option, $matches);
|
||||
if(strpos($createTableSql, $matches[4]) === false) $errorSql .= $option . "\n";
|
||||
}
|
||||
if(stripos($option, 'DROP ') !== false)
|
||||
|
||||
Reference in New Issue
Block a user