From c6b1ad5a8fa3c1a886d1db5d9f2b6d7436236af0 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 27 Feb 2017 13:49:47 +0800 Subject: [PATCH] * finish task #2895. --- module/action/config.php | 1 + module/action/lang/zh-cn.php | 2 + module/story/control.php | 1 + module/testcase/control.php | 6 ++- module/testcase/lang/zh-cn.php | 1 + module/testcase/model.php | 44 +++++++++++++++++++-- module/testcase/view/browsedata.html.php | 2 +- module/testcase/view/caseheader.html.php | 17 ++++++++ module/testcase/view/datatabledata.html.php | 2 +- module/testsuite/lang/zh-cn.php | 2 +- module/testsuite/model.php | 2 +- module/testsuite/view/browse.html.php | 5 ++- module/testsuite/view/view.html.php | 6 +-- module/testtask/control.php | 35 +++++++++++----- module/testtask/lang/zh-cn.php | 1 + module/testtask/view/linkcase.html.php | 14 ++++++- 16 files changed, 117 insertions(+), 24 deletions(-) diff --git a/module/action/config.php b/module/action/config.php index b89b15a1f0..4a5bfb6718 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -16,5 +16,6 @@ $config->action->objectNameFields['doclib'] = 'name'; $config->action->objectNameFields['todo'] = 'name'; $config->action->objectNameFields['branch'] = 'name'; $config->action->objectNameFields['module'] = 'name'; +$config->action->objectNameFields['testsuite'] = 'name'; $config->action->commonImgSize = 870; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 6eb35a5092..147ae780ff 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -61,6 +61,7 @@ $lang->action->objectTypes['doclib'] = '文档库'; $lang->action->objectTypes['todo'] = '待办'; $lang->action->objectTypes['branch'] = '分支'; $lang->action->objectTypes['module'] = '模块'; +$lang->action->objectTypes['testsuite'] = '套件'; /* 用来描述操作历史记录。*/ $lang->action->desc = new stdclass(); @@ -196,6 +197,7 @@ $lang->action->search->objectTypeList['build'] = 'Build'; $lang->action->search->objectTypeList['release'] = '发布'; $lang->action->search->objectTypeList['productplan'] = '计划'; $lang->action->search->objectTypeList['branch'] = '分支'; +$lang->action->search->objectTypeList['testsuite'] = '套件'; /* 用来在动态显示中显示动作 */ $lang->action->search->label[''] = ''; diff --git a/module/story/control.php b/module/story/control.php index 9f5d9f5032..506dff7892 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1009,6 +1009,7 @@ class story extends control $this->view->users = $this->user->getPairs('noletter'); $this->view->productID = $productID; $this->view->orderBy = $orderBy; + $this->view->suiteList = $this->loadModel('testsuite')->getSuites($productID); $this->display(); } diff --git a/module/testcase/control.php b/module/testcase/control.php index fefafc9acb..2a23969c4d 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -72,9 +72,11 @@ class testcase extends control setcookie('caseModule', 0, $this->config->cookieLife, $this->config->webRoot); } if($browseType == 'bymodule') setcookie('caseModule', (int)$param, $this->config->cookieLife, $this->config->webRoot); + if($browseType == 'bysuite') setcookie('caseSuite', (int)$param, $this->config->cookieLife, $this->config->webRoot); if($browseType != 'bymodule') $this->session->set('caseBrowseType', $browseType); $moduleID = ($browseType == 'bymodule') ? (int)$param : ($browseType == 'bysearch' ? 0 : ($this->cookie->caseModule ? $this->cookie->caseModule : 0)); + $suiteID = ($browseType == 'bysuite') ? (int)$param : ($browseType == 'bymodule' ? ($this->cookie->caseSuite ? $this->cookie->caseSuite : 0) : 0); $queryID = ($browseType == 'bysearch') ? (int)$param : 0; /* Set menu, save session. */ @@ -94,7 +96,7 @@ class testcase extends control $sort = $this->loadModel('common')->appendOrder($orderBy); /* Get test cases. */ - $cases = $this->testcase->getTestCases($productID, $branch, $browseType, $queryID, $moduleID, $sort, $pager); + $cases = $this->testcase->getTestCases($productID, $branch, $browseType, $browseType == 'bysearch' ? $queryID : $suiteID, $moduleID, $sort, $pager); /* save session .*/ $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', $browseType != 'bysearch' ? false : true); @@ -130,6 +132,8 @@ class testcase extends control $this->view->cases = $cases; $this->view->branch = $branch; $this->view->branches = $this->loadModel('branch')->getPairs($productID); + $this->view->suiteList = $this->loadModel('testsuite')->getSuites($productID); + $this->view->suiteID = $suiteID; $this->view->setShowModule = true; diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index fd15e64286..093d8d2877 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -157,4 +157,5 @@ $lang->testcase->featureBar['browse']['all'] = $lang->testcase->allCases $lang->testcase->featureBar['browse']['needconfirm'] = $lang->testcase->needConfirm; $lang->testcase->featureBar['browse']['group'] = '分组查看'; $lang->testcase->featureBar['browse']['zerocase'] = '零用例需求'; +$lang->testcase->featureBar['browse']['suite'] = '套件'; $lang->testcase->featureBar['groupcase'] = $lang->testcase->featureBar['browse']; diff --git a/module/testcase/model.php b/module/testcase/model.php index 3cba08e0ff..f8e7943e20 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -197,6 +197,31 @@ class testcaseModel extends model ->orderBy($orderBy)->page($pager)->fetchAll('id'); } + /** + * Get by suite. + * + * @param int $productID + * @param int $branch + * @param int $suiteID + * @param array $moduleIdList + * @param string $orderBy + * @param object $pager + * @access public + * @return void + */ + public function getBySuite($productID, $branch = 0, $suiteID, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null) + { + return $this->dao->select('t1.*, t2.title as storyTitle, t3.version as version')->from(TABLE_CASE)->alias('t1') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id') + ->leftJoin(TABLE_SUITECASE)->alias('t3')->on('t1.id=t3.case') + ->where('t1.product')->eq((int)$productID) + ->andWhere('t3.suite')->eq((int)$suiteID) + ->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi() + ->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi() + ->andWhere('t1.deleted')->eq('0') + ->orderBy($orderBy)->page($pager)->fetchAll('id'); + } + /** * Get case info by ID. * @@ -285,6 +310,10 @@ class testcaseModel extends model ->page($pager) ->fetchAll(); } + elseif($browseType == 'bysuite') + { + $cases = $this->getBySuite($productID, $branch, $queryID, $modules, $sort, $pager); + } /* By search. */ elseif($browseType == 'bysearch') { @@ -992,9 +1021,9 @@ class testcaseModel extends model * @access public * @return void */ - public function printCell($col, $case, $users, $branches, $modulePairs = array()) + public function printCell($col, $case, $users, $branches, $modulePairs = array(), $browseType = '') { - $caseLink = helper::createLink('testcase', 'view', "caseID=$case->id"); + $caseLink = helper::createLink('testcase', 'view', "caseID=$case->id&version=$case->version"); $account = $this->app->user->account; $id = $col->id; if($col->show) @@ -1030,7 +1059,16 @@ class testcaseModel extends model foreach(explode(',', trim($case->stage, ',')) as $stage) echo $this->lang->testcase->stageList[$stage] . '
'; break; case 'status': - echo $this->lang->testcase->statusList[$case->status]; + if($case->needconfirm) + { + echo "({$this->lang->story->changed} "; + echo html::a(helper::createLink('testcase', 'confirmStoryChange', "caseID=$case->id"), $this->lang->confirm, 'hiddenwin'); + echo ")"; + } + else + { + echo $this->lang->testcase->statusList[$case->status]; + } break; case 'story': static $stories = array(); diff --git a/module/testcase/view/browsedata.html.php b/module/testcase/view/browsedata.html.php index 337a9a2b63..65db0b862f 100644 --- a/module/testcase/view/browsedata.html.php +++ b/module/testcase/view/browsedata.html.php @@ -38,7 +38,7 @@ - id");?> + id&version=$case->version");?> id));?> diff --git a/module/testcase/view/caseheader.html.php b/module/testcase/view/caseheader.html.php index 1fe133668e..e56d5587a3 100644 --- a/module/testcase/view/caseheader.html.php +++ b/module/testcase/view/caseheader.html.php @@ -31,6 +31,23 @@ { echo "
  • " . html::a($this->createLink('testcase', 'browse', "productid=$productID&branch=$branch&browseType=$menyType"), $menuItem->text) . "
  • "; } + elseif($hasBrowsePriv and $menyType == 'suite') + { + echo "'; + } elseif($hasGroupPriv and $menyType == 'group') { echo "