diff --git a/module/block/control.php b/module/block/control.php
index c08abcf324..849daf1d1d 100644
--- a/module/block/control.php
+++ b/module/block/control.php
@@ -1628,6 +1628,7 @@ class block extends control
}
$overviewPercent = array();
+ $this->app->loadLang('project');
foreach($this->lang->project->statusList as $statusKey => $statusName)
{
if(!isset($overview[$statusKey])) $overview[$statusKey] = 0;
diff --git a/module/branch/control.php b/module/branch/control.php
index 7ccc3db271..f779ad5497 100644
--- a/module/branch/control.php
+++ b/module/branch/control.php
@@ -253,15 +253,16 @@ class branch extends control
* @param int $oldBranch
* @param string $param
* @param int $projectID
+ * @param bool $withMainBranch
* @access public
* @return void
*/
- public function ajaxGetBranches($productID, $oldBranch = 0, $param = 'all', $projectID = 0)
+ public function ajaxGetBranches($productID, $oldBranch = 0, $param = 'all', $projectID = 0, $withMainBranch = true)
{
$product = $this->loadModel('product')->getById($productID);
if(empty($product) or $product->type == 'normal') return;
- $branches = $this->loadModel('branch')->getList($productID, $projectID, $param);
+ $branches = $this->loadModel('branch')->getList($productID, $projectID, $param, 'order', null, $withMainBranch);
$branchOption = array();
$branchTagOption = array();
foreach($branches as $branchInfo)
diff --git a/module/branch/model.php b/module/branch/model.php
index ba2f199afb..9d60ac7372 100644
--- a/module/branch/model.php
+++ b/module/branch/model.php
@@ -43,10 +43,11 @@ class branchModel extends model
* @param string $browseType
* @param string $orderBy
* @param object $pager
+ * @param bool $withMainBranch
* @access public
* @return array
*/
- public function getList($productID, $executionID = 0, $browseType = 'active', $orderBy = 'order', $pager = null)
+ public function getList($productID, $executionID = 0, $browseType = 'active', $orderBy = 'order', $pager = null, $withMainBranch = true)
{
$executionBranches = array();
if($executionID)
@@ -54,7 +55,8 @@ class branchModel extends model
$executionBranches = $this->dao->select('branch')->from(TABLE_PROJECTPRODUCT)
->where('project')->eq($executionID)
->andWhere('product')->eq($productID)
- ->fetchAll('branch');
+ ->fetchPairs('branch');
+ if(in_array(BRANCH_MAIN, $executionBranches)) $withMainBranch = true;
if(empty($executionBranches)) return array();
}
@@ -73,6 +75,8 @@ class branchModel extends model
$defaultBranch = BRANCH_MAIN;
foreach($branchList as $branch) $defaultBranch = $branch->default ? $branch->id : $defaultBranch;
+ if(!$withMainBranch) return $branchList;
+
/* Display the main branch under all and active page. */
$mainBranch = new stdclass();
$mainBranch->id = BRANCH_MAIN;
diff --git a/module/company/control.php b/module/company/control.php
index 6971c65e72..55bbbb75c4 100644
--- a/module/company/control.php
+++ b/module/company/control.php
@@ -278,6 +278,7 @@ class company extends control
$this->loadModel('search')->setSearchParams($this->config->company->dynamic->search);
/* Assign. */
+ $this->view->recTotal = $recTotal;
$this->view->browseType = $browseType;
$this->view->account = $account;
$this->view->accountPairs = $accountPairs;
diff --git a/module/company/model.php b/module/company/model.php
index e189200163..be7f081894 100644
--- a/module/company/model.php
+++ b/module/company/model.php
@@ -137,7 +137,9 @@ class companyModel extends model
*/
public function update()
{
- $company = fixer::input('post')->get();
+ $company = fixer::input('post')
+ ->stripTags('name')
+ ->get();
if($company->website == 'http://') $company->website = '';
if($company->backyard == 'http://') $company->backyard = '';
$companyID = $this->app->company->id;
diff --git a/module/company/view/dynamic.html.php b/module/company/view/dynamic.html.php
index 9b580f05be..f8d518eed8 100644
--- a/module/company/view/dynamic.html.php
+++ b/module/company/view/dynamic.html.php
@@ -22,6 +22,7 @@
if($period == $browseType)
{
$active = 'btn-active-text';
+ $pager->recTotal = $recTotal ? $recTotal : $pager->recTotal;
$label .= " {$pager->recTotal}";
}
echo html::a(inlink('dynamic', "browseType=$period¶m=&recTotal=0&date=&direction=next&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy"), $label, '', "class='btn btn-link $active' id='{$period}'")
diff --git a/module/custom/config.php b/module/custom/config.php
index 71caf458a9..ff9462b546 100644
--- a/module/custom/config.php
+++ b/module/custom/config.php
@@ -54,7 +54,7 @@ $config->custom->fieldList['task']['finish'] = 'comment';
$config->custom->fieldList['task']['activate'] = 'assignedTo,comment';
$config->custom->fieldList['build'] = 'scmPath,filePath,desc';
$config->custom->fieldList['bug']['create'] = 'module,project,deadline,type,os,browser,severity,pri,steps,keywords';
-$config->custom->fieldList['bug']['edit'] = 'plan,assignedTo,deadline,type,os,browser,severity,pri,steps,keywords';
+$config->custom->fieldList['bug']['edit'] = 'plan,project,assignedTo,deadline,type,os,browser,severity,pri,steps,keywords';
$config->custom->fieldList['bug']['resolve'] = 'resolvedBuild,resolvedDate,assignedTo,comment';
$config->custom->fieldList['testcase']['create'] = 'stage,story,pri,precondition,keywords';
$config->custom->fieldList['testcase']['edit'] = 'stage,story,pri,precondition,keywords,status';
diff --git a/module/doc/css/objectlibs.css b/module/doc/css/objectlibs.css
index 8ced76e32c..71a6036c15 100644
--- a/module/doc/css/objectlibs.css
+++ b/module/doc/css/objectlibs.css
@@ -47,3 +47,4 @@
.tree-group .tree-actions {display: none; position: absolute; right: 0; top: 0; background-color: #fff; white-space: nowrap;}
.tree-group:hover > .module-name {width: calc(100% - 20px);}
.tree-group:hover .tree-actions {display: block}
+.tree li.has-list.open:before {left: 6px;}
diff --git a/module/execution/control.php b/module/execution/control.php
index 01863e5d8c..27aa1e597c 100644
--- a/module/execution/control.php
+++ b/module/execution/control.php
@@ -2036,7 +2036,8 @@ class execution extends control
public function kanban($executionID, $browseType = 'all', $orderBy = 'id_asc', $groupBy = 'default')
{
$this->app->loadLang('bug');
- $this->app->loadLang('story');
+ $this->loadModel('story');
+
if(empty($groupBy)) $groupBy = 'default';
$this->session->set('execLaneType', $browseType);
@@ -2104,6 +2105,7 @@ class execution extends control
$this->view->kanbanData = $kanbanData;
$this->view->executionActions = $executionActions;
$this->view->kanban = $this->lang->execution->kanban;
+ $this->view->reviewStoryParis = $this->story->getExecutionStoryPairs($execution->id, 0, 'all', 0, 'full', 'review');
$this->display();
}
@@ -2129,9 +2131,9 @@ class execution extends control
$this->app->session->set('kanbanType', $browseType, 'execution');
/* Load language. */
- $this->app->loadLang('story');
$this->app->loadLang('task');
$this->app->loadLang('bug');
+ $this->loadModel('story');
$this->loadModel('kanban');
/* Compatibility IE8. */
@@ -2176,23 +2178,22 @@ class execution extends control
$userList['closed']['realname'] = 'Closed';
$userList['closed']['avatar'] = '';
- $this->view->title = $this->lang->execution->kanban;
- $this->view->position[] = html::a($this->createLink('execution', 'browse', "executionID=$executionID"), $execution->name);
- $this->view->position[] = $this->lang->execution->kanban;
- $this->view->realnames = $this->loadModel('user')->getPairs('noletter');
- $this->view->storyOrder = $orderBy;
- $this->view->orderBy = 'id_asc';
- $this->view->executionID = $executionID;
- $this->view->productID = $productID;
- $this->view->productNames = $productNames;
- $this->view->productNum = count($products);
- $this->view->allPlans = $allPlans;
- $this->view->browseType = $browseType;
- $this->view->kanbanGroup = $kanbanGroup;
- $this->view->execution = $execution;
- $this->view->groupBy = $groupBy;
- $this->view->canBeChanged = $canBeChanged;
- $this->view->userList = $userList;
+ $this->view->title = $this->lang->execution->kanban;
+ $this->view->realnames = $this->loadModel('user')->getPairs('noletter');
+ $this->view->storyOrder = $orderBy;
+ $this->view->orderBy = 'id_asc';
+ $this->view->executionID = $executionID;
+ $this->view->productID = $productID;
+ $this->view->productNames = $productNames;
+ $this->view->productNum = count($products);
+ $this->view->allPlans = $allPlans;
+ $this->view->browseType = $browseType;
+ $this->view->kanbanGroup = $kanbanGroup;
+ $this->view->execution = $execution;
+ $this->view->groupBy = $groupBy;
+ $this->view->canBeChanged = $canBeChanged;
+ $this->view->userList = $userList;
+ $this->view->reviewStoryParis = $this->story->getExecutionStoryPairs($execution->id, 0, 'all', 0, 'full', 'review');
$this->display();
}
diff --git a/module/execution/js/common.js b/module/execution/js/common.js
index 8bb7171a8d..95c24dca12 100644
--- a/module/execution/js/common.js
+++ b/module/execution/js/common.js
@@ -155,7 +155,7 @@ function loadBranches(product)
var projectID = (typeof(systemMode) != 'undefined' && systemMode == 'new') ? $('#project').val() : 0;
var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
- $.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val() + "&oldBranch=0¶m=active&projectID=" + projectID), function(data)
+ $.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val() + "&oldBranch=0¶m=active&projectID=" + projectID + "&withMainBranch="), function(data)
{
if(data)
{
diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js
index 0526035b56..8cb29abfe6 100644
--- a/module/execution/js/kanban.js
+++ b/module/execution/js/kanban.js
@@ -461,8 +461,8 @@ function renderStoryItem(item, $item, col)
var $title = $item.find('.title');
if(!$title.length)
{
- $title = $('' + (scaleSize <= 1 ? ' ' : '') + '')
- .attr('href', $.createLink('story', 'view', 'storyID=' + item.id + '&version=0¶m=' + execution.id, '', true)).attr('data-toggle', 'modal').attr('data-width', '80%');
+ $title = $('' + (scaleSize <= 1 ? ' ' : '') + '')
+ .attr('href', $.createLink('story', 'view', 'storyID=' + item.id + '&version=0¶m=' + execution.id, '', true)).attr('data-toggle', 'modal').attr('data-width', '95%');
$title.appendTo($item);
}
$title.attr('title', item.title).find('.text').text(item.title);
@@ -959,6 +959,12 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
{
if(toColType == 'ready' || toColType == 'backlog')
{
+ if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined')
+ {
+ bootbox.alert(executionLang.storyDragError);
+ return false;
+ }
+
var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy + '®ionID=' + regionID+ '&orderBy=' + orderBy );
$.ajax(
{
diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js
index 31001c0e6a..8d7ee93d06 100644
--- a/module/execution/js/taskkanban.js
+++ b/module/execution/js/taskkanban.js
@@ -685,6 +685,12 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
{
if(toColType == 'ready' || toColType == 'backlog')
{
+ if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined')
+ {
+ bootbox.alert(executionLang.storyDragError);
+ return false;
+ }
+
var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy);
$.get(link, function(data)
{
diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php
index 1fec85518d..806186714b 100644
--- a/module/execution/lang/en.php
+++ b/module/execution/lang/en.php
@@ -367,6 +367,7 @@ $lang->execution->unresolvedBug = "[%s] unresolved bugs. ";
$lang->execution->projectNotEmpty = 'Project cannot be empty.';
$lang->execution->confirmStoryToTask = $lang->SRCommon . '%s are converted to tasks in the current. Do you want to convert them anyways?';
$lang->execution->ge = "『%s』should be >= actual begin『%s』.";
+$lang->execution->storyDragError = "The {$lang->SRCommon} is still a draft or has been changed, please drag it after the review";
/* Statistics. */
$lang->execution->charts = new stdclass();
diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php
index 4ec225e111..b8c43a0442 100644
--- a/module/execution/lang/zh-cn.php
+++ b/module/execution/lang/zh-cn.php
@@ -367,6 +367,7 @@ $lang->execution->unresolvedBug = "[%s]个未解决的bug,";
$lang->execution->projectNotEmpty = '所属项目不能为空。';
$lang->execution->confirmStoryToTask = '%s' . $lang->SRCommon . '已经在当前' . $lang->execution->common . '中转了任务,请确认是否重复转任务。';
$lang->execution->ge = "『%s』应当不小于实际开始时间『%s』。";
+$lang->execution->storyDragError = "该{$lang->SRCommon}还是草稿或已变更状态,请评审通过后再拖动";
/* 统计。*/
$lang->execution->charts = new stdclass();
diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php
index 05e5e217a9..80d3bab88d 100644
--- a/module/execution/view/kanban.html.php
+++ b/module/execution/view/kanban.html.php
@@ -51,6 +51,7 @@ js::set('projectID', $projectID);
js::set('vision', $this->config->vision);
js::set('productCount', count($productNames));
js::set('executionID', $execution->id);
+js::set('reviewStoryParis', $reviewStoryParis);
$canSortRegion = commonModel::hasPriv('kanban', 'sortRegion') && count($regions) > 1;
$canEditRegion = commonModel::hasPriv('kanban', 'editRegion');
diff --git a/module/execution/view/taskkanban.html.php b/module/execution/view/taskkanban.html.php
index 8be39bc3c1..4d86ea58cd 100644
--- a/module/execution/view/taskkanban.html.php
+++ b/module/execution/view/taskkanban.html.php
@@ -211,4 +211,5 @@ js::set('priv',
fluidBoard);?>
displayCards);?>
+
diff --git a/module/productplan/model.php b/module/productplan/model.php
index 3f492c6dd2..2e0ebb32f3 100644
--- a/module/productplan/model.php
+++ b/module/productplan/model.php
@@ -83,7 +83,7 @@ class productplanModel extends model
$date = date('Y-m-d');
$plans = $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('product')->eq($product)
->andWhere('deleted')->eq(0)
- ->beginIF(!empty($branch))->andWhere('branch')->eq($branch)->fi()
+ ->beginIF(!empty($branch) and $branch != 'all')->andWhere('branch')->eq($branch)->fi()
->beginIF($browseType != 'all')->andWhere('status')->eq($browseType)->fi()
->beginIF(strpos($param, 'skipparent') !== false)->andWhere('parent')->ne(-1)->fi()
->orderBy($orderBy)
diff --git a/module/repo/control.php b/module/repo/control.php
index d60569ed4f..b3df7d5b68 100644
--- a/module/repo/control.php
+++ b/module/repo/control.php
@@ -360,7 +360,7 @@ class repo extends control
public function browse($repoID = 0, $branchID = '', $objectID = 0, $path = '', $revision = 'HEAD', $refresh = 0)
{
$repoID = $this->repo->saveState($repoID, $objectID);
- if($branchID) $branchID = base64_decode($branchID);
+ if($branchID) $branchID = base64_decode(urldecode($branchID));
/* Get path and refresh. */
if($this->get->repoPath) $path = $this->get->repoPath;
diff --git a/module/repo/view/browse.html.php b/module/repo/view/browse.html.php
index 3f6fdedf9c..2fa67be799 100644
--- a/module/repo/view/browse.html.php
+++ b/module/repo/view/browse.html.php
@@ -31,7 +31,7 @@
foreach($branches as $id => $branchName)
{
$isSelected = $id == $branchID ? 'class="selected"' : '';
- $base64BranchID = base64_encode($id);
+ $base64BranchID = urlencode(base64_encode($id));
echo "
" . html::a($this->createLink('repo', 'browse', "repoID=$repoID&branchID=$base64BranchID&objectID=$objectID"), $branchName, '', "title='{$branchName}' class='text-ellipsis' data-app='{$app->tab}'") . "";
}
?>
diff --git a/module/story/lang/en.php b/module/story/lang/en.php
index 7c15156424..78ff05105a 100644
--- a/module/story/lang/en.php
+++ b/module/story/lang/en.php
@@ -268,6 +268,7 @@ $lang->story->specTemplate = "As a < type of user >, I want < some goal
$lang->story->needNotReview = 'No Review';
$lang->story->successSaved = "Story is saved!";
$lang->story->confirmDelete = "Do you want to delete this story?";
+$lang->story->confirmRecall = "Do you want to recall this story?";
$lang->story->errorEmptyChildStory = '『Decomposed Stories』canot be blank.';
$lang->story->errorNotSubdivide = "If the status is not active, or the stage is not wait, or a sub story, it cannot be subdivided.";
$lang->story->errorEmptyReviewedBy = "『ReviewedBy』canot be blank.";
diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php
index 9c0e7761d3..ff0751f10c 100644
--- a/module/story/lang/zh-cn.php
+++ b/module/story/lang/zh-cn.php
@@ -268,6 +268,7 @@ $lang->story->specTemplate = "建议参考的模板:作为一名<某
$lang->story->needNotReview = '不需要评审';
$lang->story->successSaved = "{$lang->SRCommon}成功添加,";
$lang->story->confirmDelete = "您确认删除该{$lang->SRCommon}吗?";
+$lang->story->confirmRecall = "您确认撤销该{$lang->SRCommon}吗?";
$lang->story->errorEmptyChildStory = "『细分{$lang->SRCommon}』不能为空。";
$lang->story->errorNotSubdivide = "状态不是激活,或者阶段不是未开始的{$lang->SRCommon},或者是子需求,则不能细分。";
$lang->story->errorEmptyReviewedBy = "『由谁评审』不能为空。";
diff --git a/module/story/model.php b/module/story/model.php
index e6cf7057ce..d5eedc2706 100644
--- a/module/story/model.php
+++ b/module/story/model.php
@@ -2873,7 +2873,7 @@ class storyModel extends model
* @param int $branch
* @param array|string $moduleIdList
* @param string $type full|short
- * @param string $status all|unclosed
+ * @param string $status all|unclosed|review
* @access public
* @return array
*/
@@ -2890,6 +2890,7 @@ class storyModel extends model
->beginIF($branch !== 'all')->andWhere('t2.branch')->eq($branch)->fi()
->beginIF($moduleIdList)->andWhere('t2.module')->in($moduleIdList)->fi()
->beginIF($status == 'unclosed')->andWhere('t2.status')->ne('closed')->fi()
+ ->beginIF($status == 'review')->andWhere('t2.status')->in('draft,changed')->fi()
->orderBy('t1.`order` desc')
->fetchAll('id');
return empty($stories) ? array() : $this->formatStories($stories, $type);
diff --git a/module/user/js/edit.js b/module/user/js/edit.js
index 75dd95ca6c..664049ff89 100644
--- a/module/user/js/edit.js
+++ b/module/user/js/edit.js
@@ -8,8 +8,8 @@ $(function()
{
if(!password1Encrypted && !password2Encrypted)
{
- var password1 = $('#password1').val();
- var password2 = $('#password2').val();
+ var password1 = $('#password1').val().trim();
+ var password2 = $('#password2').val().trim();
var passwordStrength = computePasswordStrength(password1);
if($("form input[name=passwordStrength]").length == 0) $('#submit').after("");
diff --git a/test/class/design.class.php b/test/class/design.class.php
index 707cd48d02..7e09e62658 100644
--- a/test/class/design.class.php
+++ b/test/class/design.class.php
@@ -98,6 +98,14 @@ class designTest
return $objects;
}
+ /**
+ * Function assign test by desgin
+ *
+ * @param int $designID
+ * @param array $param
+ * @access public
+ * @return array
+ */
public function assignTest($designID, $param = array())
{
global $tester;
@@ -118,12 +126,25 @@ class designTest
return $objects;
}
- public function linkCommitTest($designID = 0, $repoID = 0)
+ public function linkCommitTest($designID, $repoID, $param = array())
{
- $objects = $this->objectModel->linkCommit($designID = 0, $repoID = 0);
+ global $tester;
+
+ $revision = array();
+
+ $createFields = array('revision' => $revision);
+
+ foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
+ foreach($param as $key => $value) $_POST[$key] = $value;
+
+ $this->objectModel->linkCommit($designID, $repoID);
+
+ unset($_POST);
if(dao::isError()) return dao::getError();
+ $objects = $tester->dao->select('*')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetchAll();
+
return $objects;
}
@@ -136,24 +157,6 @@ class designTest
return $objects;
}
- public function getByIDTest($designID = 0)
- {
- $objects = $this->objectModel->getByID($designID = 0);
-
- if(dao::isError()) return dao::getError();
-
- return $objects;
- }
-
- public function getPairsTest($productID = 0, $type = 'all')
- {
- $objects = $this->objectModel->getPairs($productID = 0, $type = 'all');
-
- if(dao::isError()) return dao::getError();
-
- return $objects;
- }
-
public function getAffectedScopeTest($design = 0)
{
$objects = $this->objectModel->getAffectedScope($design = 0);
diff --git a/test/class/testcase.class.php b/test/class/testcase.class.php
new file mode 100644
index 0000000000..37d196839d
--- /dev/null
+++ b/test/class/testcase.class.php
@@ -0,0 +1,456 @@
+objectModel = $tester->loadModel('testcase');
+ }
+
+ /**
+ * Test get cases of a module.
+ *
+ * @param int $productID
+ * @param int $branch
+ * @param int $moduleIdList
+ * @param string $orderBy
+ * @param object $pager
+ * @param string $browseType
+ * @param string $auto
+ * @access public
+ * @return array
+ */
+ public function getModuleCasesTest($productID, $branch = 0, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null, $browseType = '', $auto = 'no')
+ {
+ $objects = $this->objectModel->getModuleCases($productID, $branch, $moduleIdList, $orderBy, $pager, $browseType, $auto);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test get project cases of a module.
+ *
+ * @param int $productID
+ * @param int $branch
+ * @param int $moduleIdList
+ * @param string $orderBy
+ * @param object $pager
+ * @param string $browseType
+ * @param string $auto
+ * @access public
+ * @return array
+ */
+ public function getModuleProjectCasesTest($productID, $branch = 0, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null, $browseType = '', $auto = 'no')
+ {
+ $objects = $this->objectModel->getModuleProjectCases($productID, $branch, $moduleIdList, $orderBy, $pager, $browseType, $auto);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function getProjectCasesTest($projectID, $orderBy = 'id_desc', $pager = null, $browseType = '')
+ {
+ $objects = $this->objectModel->getProjectCases($projectID, $orderBy = 'id_desc', $pager = null, $browseType = '');
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test get execution cases.
+ *
+ * @param int $executionID
+ * @param string $orderBy
+ * @param object $pager
+ * @param string $browseType
+ * @access public
+ * @return string
+ */
+ public function getExecutionCasesTest($executionID, $orderBy = 'id_desc', $pager = null, $browseType = '')
+ {
+ $objects = $this->objectModel->getExecutionCases($executionID, $orderBy, $pager, $browseType);
+
+ if(dao::isError()) return dao::getError();
+
+ return $browseType == 'all' ? $objects : count($objects);
+ }
+
+ /**
+ * Test get cases by suite.
+ *
+ * @param int $productID
+ * @param int $branch
+ * @param int $suiteID
+ * @param int $moduleIdList
+ * @param string $orderBy
+ * @param object $pager
+ * @param string $auto
+ * @access public
+ * @return array
+ */
+ public function getBySuiteTest($productID, $branch = 0, $suiteID = 0, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null, $auto = 'no')
+ {
+ $objects = $this->objectModel->getBySuite($productID, $branch, $suiteID, $moduleIdList, $orderBy, $pager, $auto);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test get case info by ID.
+ *
+ * @param int $caseID
+ * @param int $version
+ * @access public
+ * @return object
+ */
+ public function getByIdTest($caseID, $version = 0)
+ {
+ $object = $this->objectModel->getById($caseID, $version = 0);
+
+ if(dao::isError()) return dao::getError();
+
+ return $object;
+ }
+
+ /**
+ * Test get case list.
+ *
+ * @param string $caseIDList
+ * @access public
+ * @return array
+ */
+ public function getByListTest($caseIDList = 0)
+ {
+ $objects = $this->objectModel->getByList($caseIDList = 0);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function getTestCasesTest($productID, $branch, $browseType, $queryID, $moduleID, $sort, $pager, $auto = 'no')
+ {
+ $objects = $this->objectModel->getTestCases($productID, $branch, $browseType, $queryID, $moduleID, $sort, $pager, $auto = 'no');
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test get cases by assignedTo.
+ *
+ * @param string $account
+ * @param string $orderBy
+ * @param object $pager
+ * @param string $auto
+ * @access public
+ * @return string
+ */
+ public function getByAssignedToTest($account, $orderBy = 'id_desc', $pager = null, $auto = 'no')
+ {
+ $objects = $this->objectModel->getByAssignedTo($account, $orderBy = 'id_desc', $pager = null, $auto = 'no');
+
+ if(dao::isError()) return dao::getError();
+
+ $ids = implode(array_keys($objects), ',');
+ return $ids;
+ }
+
+ /**
+ * Test get cases by openedBy
+ *
+ * @param string $account
+ * @param string $orderBy
+ * @param object $pager
+ * @param string $auto
+ * @access public
+ * @return array
+ */
+ public function getByOpenedByTest($account, $orderBy = 'id_desc', $pager = null, $auto = 'no')
+ {
+ $objects = $this->objectModel->getByOpenedBy($account, $orderBy = 'id_desc', $pager = null, $auto = 'no');
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function getByStatusTest($productID = 0, $branch = 0, $type = 'all', $status = 'all', $moduleID = 0, $orderBy = 'id_desc', $pager = null, $auto = 'no')
+ {
+ $objects = $this->objectModel->getByStatus($productID, $branch, $type, $status, $moduleID, $orderBy, $pager, $auto);
+
+ if(dao::isError()) return dao::getError();
+
+ return count($objects);
+ }
+
+ public function getStoryCasesTest($storyID)
+ {
+ $objects = $this->objectModel->getStoryCases($storyID);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test get counts of some stories' cases.
+ *
+ * @param array $stories
+ * @access public
+ * @return void
+ */
+ public function getStoryCaseCountsTest($stories)
+ {
+ $counts = $this->objectModel->getStoryCaseCounts($stories);
+
+ if(dao::isError()) return dao::getError();
+
+ return $counts;
+ }
+
+ public function updateTest($caseID)
+ {
+ $objects = $this->objectModel->update($caseID);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function reviewTest($caseID)
+ {
+ $objects = $this->objectModel->review($caseID);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test batch review cases.
+ *
+ * @param array $caseIdList
+ * @param string $result
+ * @access public
+ * @return array
+ */
+ public function batchReviewTest($caseIdList, $result)
+ {
+ $objects = $this->objectModel->batchReview($caseIdList, $result);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function getCases2LinkTest($caseID, $browseType = 'bySearch', $queryID = 0)
+ {
+ $objects = $this->objectModel->getCases2Link($caseID, $browseType = 'bySearch', $queryID = 0);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function batchUpdateTest($param = array())
+ {
+ $batchUpdateField['caseIDList'] = array('1' => 1, '2' => 2, '3' => 3, '4' => 4);
+ $batchUpdateField['pris'] = array('1' => 1, '2' => 2, '3' => 3, '4' => 4);
+ $batchUpdateField['statuses'] = array('1' => 'wait', '2' => 'normal', '3' => 'blocked', '4' => 'investigate');
+ $batchUpdateField['modules'] = array('1' => 0, '2' => 0, '3' => 0, '4' => 0);
+ $batchUpdateField['branches'] = array('1' => 0, '2' => 0, '3' => 0, '4' => 0);
+ $batchUpdateField['story'] = array('1' => 0, '2' => 0, '3' => 0, '4' => 0);
+ $batchUpdateField['product'] = array('1' => 1, '2' => 1, '3' => 1, '4' => 1);
+ $batchUpdateField['title'] = array('1' => '这个是测试用例1', '2' => '这个是测试用例2', '3' => '这个是测试用例3', '4' => '这个是测试用例4');
+ $batchUpdateField['color'] = array('1' => '#3da7f5', '2' => '#75c941', '3' => '#2dbdb2', '4' => '#797ec9');
+ $batchUpdateField['types'] = array('1' => 'feature', '2' => 'performance', '3' => 'config', '4' => 'install');
+ $batchUpdateField['precondition'] = array('1' => '这是前置条件1', '2' => '这是前置条件2', '3' => '这是前置条件3', '4' => '这是前置条件4');
+ $batchUpdateField['keywords'] = array('1' => '这是关键词1', '2' => '这是关键词2', '3' => '这是关键词3', '4' => '这是关键词4');
+ $batchUpdateField['stages'] = array('1' => array('unittest'), '2' => array('feature'), '3' => array('intergrate'), '4' => array('system'));
+
+ foreach($batchUpdateField as $field => $defaultValue) $_POST[$field] = $defaultValue;
+
+ foreach($param as $key => $value) $_POST[$key] = $value;
+
+ $objects = $this->objectModel->batchUpdate();
+
+ unset($_POST);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test batch change branch.
+ *
+ * @param array $caseIDList
+ * @param int $branchID
+ * @access public
+ * @return array
+ */
+ public function batchChangeBranchTest($caseIDList, $branchID)
+ {
+ $this->objectModel->batchChangeBranch($caseIDList, $branchID);
+
+ if(dao::isError()) return dao::getError();
+
+ $objects = $this->objectModel->getByList($caseIDList);
+ return $objects;
+ }
+
+ /**
+ * Test batch change module.
+ *
+ * @param array $caseIDList
+ * @param int $moduleID
+ * @access public
+ * @return array
+ */
+ public function batchChangeModuleTest($caseIDList, $moduleID)
+ {
+ $this->objectModel->batchChangeModule($caseIDList, $moduleID);
+
+ if(dao::isError()) return dao::getError();
+
+ $objects = $this->objectModel->getByList($caseIDList);
+ return $objects;
+ }
+
+ /**
+ * Test batch case type change.
+ *
+ * @param array $caseIdList
+ * @param string $result
+ * @access public
+ * @return array
+ */
+ public function batchCaseTypeChangeTest($caseIdList, $result)
+ {
+ $this->objectModel->batchCaseTypeChange($caseIdList, $result);
+
+ if(dao::isError()) return dao::getError();
+
+ $objects = $this->objectModel->getByList($caseIdList);
+ return $objects;
+ }
+
+ public function joinStepTest($steps)
+ {
+ $objects = $this->objectModel->joinStep($steps);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function createFromImportTest($productID, $branch = 0)
+ {
+ $objects = $this->objectModel->createFromImport($productID, $branch = 0);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test get fields for import.
+ *
+ * @param int $productID
+ * @access public
+ * @return array
+ */
+ public function getImportFieldsTest($productID = 0)
+ {
+ $object = $this->objectModel->getImportFields($productID);
+
+ if(dao::isError()) return dao::getError();
+
+ return $object;
+ }
+
+ public function importFromLibTest($productID)
+ {
+ $objects = $this->objectModel->importFromLib($productID);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function buildSearchFormTest($productID, $products, $queryID, $actionURL, $projectID = 0)
+ {
+ $objects = $this->objectModel->buildSearchForm($productID, $products, $queryID, $actionURL, $projectID = 0);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test append bugs and results.
+ *
+ * @param array $cases
+ * @param string $type
+ * @access public
+ * @return array
+ */
+ public function appendDataTest($cases, $type = 'case')
+ {
+ $objects = $this->objectModel->appendData($cases, $type = 'case');
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ /**
+ * Test check whether force not review.
+ *
+ * @access public
+ * @return int
+ */
+ public function forceNotReviewTest()
+ {
+ $object = $this->objectModel->forceNotReview();
+
+ if(dao::isError()) return dao::getError();
+
+ return $object ? 1 : 2;
+ }
+
+ public function syncCase2ProjectTest($case, $caseID)
+ {
+ $objects = $this->objectModel->syncCase2Project($case, $caseID);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function updateCase2ProjectTest($oldCase, $case, $caseID)
+ {
+ $objects = $this->objectModel->updateCase2Project($oldCase, $case, $caseID);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+
+ public function getStatusTest($methodName, $case = null)
+ {
+ $objects = $this->objectModel->getStatus($methodName, $case = null);
+
+ if(dao::isError()) return dao::getError();
+
+ return $objects;
+ }
+}
diff --git a/test/data/zt_config.sql b/test/data/zt_config.sql
index 4f57594c7c..6fdca440f9 100644
--- a/test/data/zt_config.sql
+++ b/test/data/zt_config.sql
@@ -8,7 +8,7 @@ INSERT INTO `zt_config` (`id`, `vision`, `owner`, `module`, `section`, `key`, `v
(6, 'rnd', 'system', 'project', '', 'unitList', 'CNY,USD'),
(7, 'rnd', 'system', 'project', '', 'defaultCurrency', 'CNY'),
(8, 'rnd', 'system', 'story', '', 'reviewRules', 'allpass'),
-(10, 'rnd', 'system', 'common', 'global', 'version', '16.5.beta1'),
+(10, 'rnd', 'system', 'common', 'global', 'version', '16.5'),
(11, 'rnd', 'system', 'common', 'global', 'sn', 'c8aa3269e181f2b9258ce96625de1497'),
(12, 'rnd', 'system', 'common', 'global', 'flow', 'full'),
(13, 'rnd', 'system', 'common', 'safe', 'mode', '1'),
diff --git a/test/model/design/getbyid.php b/test/model/design/getbyid.php
index 203545d5ef..805bc16f8b 100644
--- a/test/model/design/getbyid.php
+++ b/test/model/design/getbyid.php
@@ -11,7 +11,10 @@ cid=1
pid=1
*/
+global $tester;
+$design = $tester->loadModel('design');
-$design = new designTest();
+$designIDList = array('0', '1');
-r($design->getByIDTest()) && p() && e();
\ No newline at end of file
+r($design->getByID($designIDList[1])) && p('name') && e('这是一个设计1');//正常根据id查询
+r($design->getByID($designIDList[0])) && p() && e('0'); //查询不存在的设计id
diff --git a/test/model/design/getpairs.php b/test/model/design/getpairs.php
index b4e44c88af..486225b07d 100644
--- a/test/model/design/getpairs.php
+++ b/test/model/design/getpairs.php
@@ -11,7 +11,15 @@ cid=1
pid=1
*/
+global $tester;
+$design = $tester->loadModel('design');
-$design = new designTest();
+$productIDList = array('0', '31');
+$types = array('all', 'HLDS', 'DDS', 'DBDS', 'ADS', '0');
-r($design->getPairsTest()) && p() && e();
\ No newline at end of file
+r($design->getPairs($productIDList[0], $types[1])) && p() && e('0'); //查询不存在的产品
+r($design->getPairs($productIDList[1], $types[0])) && p() && e('0'); //查询不存在的类型
+r($design->getPairs($productIDList[1], $types[1])) && p('1') && e('1:这是一个设计1');//查询HLDS设计
+r($design->getPairs($productIDList[1], $types[2])) && p('2') && e('2:这是一个设计2');//查询DDS设计
+r($design->getPairs($productIDList[1], $types[3])) && p('3') && e('3:这是一个设计3');//查询DBDS设计
+r($design->getPairs($productIDList[1], $types[4])) && p('4') && e('4:这是一个设计4');//查询ADS设计
diff --git a/test/model/design/linkcommit.php b/test/model/design/linkcommit.php
deleted file mode 100644
index c4a550922f..0000000000
--- a/test/model/design/linkcommit.php
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env php
-linkCommit();
-cid=1
-pid=1
-
-*/
-
-$design = new designTest();
-
-r($design->linkCommitTest()) && p() && e();
\ No newline at end of file
diff --git a/test/model/design/linkcommit.php.bak b/test/model/design/linkcommit.php.bak
new file mode 100644
index 0000000000..7442b9b8b5
--- /dev/null
+++ b/test/model/design/linkcommit.php.bak
@@ -0,0 +1,22 @@
+#!/usr/bin/env php
+linkCommit();
+cid=1
+pid=1
+
+*/
+$designIDList = array('0', '1');
+$repoIDList = array('0', '1');
+$revision = array('24', '25', '26', '27');
+
+$normalLink = array('revision' => $revision);
+
+$design = new designTest();
+var_dump($design->linkCommitTest($designIDList[1], $repoIDList[1], $normalLink));die;
+r($design->linkCommitTest()) && p() && e();
diff --git a/test/model/design/unlinkcommit.php b/test/model/design/unlinkcommit.php.bak
similarity index 100%
rename from test/model/design/unlinkcommit.php
rename to test/model/design/unlinkcommit.php.bak