* Finish task #56635.
This commit is contained in:
@@ -104,6 +104,24 @@ class testsuiteModel extends model
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get test suites pairs of a product.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getSuitePairs($productID)
|
||||
{
|
||||
return $this->dao->select("id, name")->from(TABLE_TESTSUITE)
|
||||
->where('product')->eq((int)$productID)
|
||||
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('project')->eq($this->session->project)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->andWhere("(`type` = 'public' OR (`type` = 'private' and addedBy = '{$this->app->user->account}'))")
|
||||
->orderBy('id_desc')
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unit suite.
|
||||
*
|
||||
@@ -220,6 +238,27 @@ class testsuiteModel extends model
|
||||
return $this->loadModel('testcase')->appendData($cases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get linked cases pairs of suite.
|
||||
*
|
||||
* @param int $suiteID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLinkedCasePairs($suiteID)
|
||||
{
|
||||
$suite = $this->getById($suiteID);
|
||||
return $this->dao->select('t1.*,t2.version as caseVersion')->from(TABLE_CASE)->alias('t1')
|
||||
->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case')
|
||||
->where('t2.suite')->eq($suiteID)
|
||||
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('t1.project')->eq($this->session->project)->fi()
|
||||
->andWhere('t1.product')->eq($suite->product)
|
||||
->andWhere('t1.product')->eq($suite->product)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy('id_desc')
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unlinked cases for suite.
|
||||
*
|
||||
|
||||
@@ -533,6 +533,8 @@ class testtask extends control
|
||||
$this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
|
||||
$this->config->testcase->search['params']['status']['values'] = array('' => '') + $this->lang->testtask->statusList;
|
||||
$this->config->testcase->search['params']['lib']['values'] = $this->loadModel('caselib')->getLibraries();
|
||||
$this->config->testcase->search['fields']['suite'] = $this->lang->testcase->suite;
|
||||
$this->config->testcase->search['params']['suite'] = array('operator' => '=', 'control' => 'select', 'values' => $this->loadModel('testsuite')->getSuitePairs($productID));
|
||||
|
||||
$this->config->testcase->search['queryID'] = $queryID;
|
||||
$this->config->testcase->search['fields']['assignedTo'] = $this->lang->testtask->assignedTo;
|
||||
|
||||
@@ -1030,6 +1030,22 @@ class testtaskModel extends model
|
||||
|
||||
$caseQuery = preg_replace('/`(\w+)`/', 't2.`$1`', $caseQuery);
|
||||
$caseQuery = str_replace(array('t2.`assignedTo`', 't2.`lastRunner`', 't2.`lastRunDate`', 't2.`lastRunResult`', 't2.`status`'), array('t1.`assignedTo`', 't1.`lastRunner`', 't1.`lastRunDate`', 't1.`lastRunResult`', 't1.`status`'), $caseQuery);
|
||||
if(strpos($caseQuery, "t2.`suite`") !== false)
|
||||
{
|
||||
preg_match("/ t2.`suite` = '\d+'/", $caseQuery, $match);
|
||||
if(!empty($match))
|
||||
{
|
||||
$match = current($match);
|
||||
$suiteQuery = str_replace(' t2.`suite` = ', '', $match);
|
||||
$suiteQuery = trim($suiteQuery, "'");
|
||||
$suiteID = intval($suiteQuery);
|
||||
|
||||
$suiteCases = $this->loadModel('testsuite')->getLinkedCasePairs($suiteID);
|
||||
|
||||
$query = " t2.`id` " . helper::dbIN(array_keys($suiteCases));
|
||||
$caseQuery = preg_replace("/ t2.`suite` = '\d+'/", $query, $caseQuery, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Select the table for these special fields. */
|
||||
$specialFields = ',assignedTo,status,lastRunResult,lastRunner,lastRunDate,';
|
||||
|
||||
Reference in New Issue
Block a user