* Adjust the test module related code.

This commit is contained in:
leiyong
2020-11-16 14:50:04 +08:00
parent aba9dbc8cf
commit 3272d0c454
21 changed files with 104 additions and 82 deletions
-5
View File
@@ -128,11 +128,6 @@ class bug extends control
/* Get bugs. */
$bugs = $this->bug->getBugs($productID, $projects, $branch, $browseType, $moduleID, $queryID, $sort, $pager);
if(empty($bugs) and $pageID > 1)
{
$pager = pager::init(0, $recPerPage, 1);
$bugs = $this->bug->getBugs($productID, $projects, $branch, $browseType, $moduleID, $queryID, $sort, $pager);
}
/* Process the sql, get the conditon partion, save it to session. */
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug', $browseType == 'needconfirm' ? false : true);
+1
View File
@@ -139,6 +139,7 @@ class buildModel extends model
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
->where('t1.product')->in($products)
->andWhere('t1.PRJ')->eq($this->session->PRJ)
->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
+4 -1
View File
@@ -258,6 +258,7 @@ class caselibModel extends model
{
$cases = $this->dao->select('*')->from(TABLE_CASE)
->where('lib')->eq((int)$libID)
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('product')->eq(0)
->beginIF($moduleIdList)->andWhere('module')->in($moduleIdList)->fi()
->beginIF($browseType == 'wait')->andWhere('status')->eq($browseType)->fi()
@@ -294,10 +295,10 @@ class caselibModel extends model
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($caseQuery)
->beginIF($queryLibID != 'all')->andWhere('lib')->eq((int)$libID)->fi()
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('product')->eq(0)
->andWhere('deleted')->eq(0)
->orderBy($sort)->page($pager)->fetchAll();
}
return $cases;
}
@@ -515,6 +516,7 @@ class caselibModel extends model
}
else
{
$caseData->PRJ = $this->session->PRJ;
$caseData->version = 1;
$caseData->openedBy = $this->app->user->account;
$caseData->openedDate = $now;
@@ -608,6 +610,7 @@ class caselibModel extends model
$data[$i]->openedDate = $now;
$data[$i]->status = $forceNotReview ? 'normal' : 'wait';
$data[$i]->version = 1;
$data[$i]->PRJ = $this->session->PRJ;
$this->dao->insert(TABLE_CASE)->data($data[$i])
->autoCheck()
-3
View File
@@ -2309,9 +2309,6 @@ EOD;
if($program->model == 'waterfall')
{
$lang->navGroup->product = 'project';
$lang->product->menu = $lang->waterfallproduct->menu;
$lang->productplan->menu = $lang->waterfallproduct->menu;
$lang->story->menu = $lang->waterfallproduct->menu;
$lang->$moduleName->menu = self::processMenuVars($lang->$moduleName->menu);
}
}
+1 -1
View File
@@ -703,7 +703,7 @@ class product extends control
if($module != 'product')
{
$products = $this->product->getProductIDByProject($this->session->PRJ);
$products = $this->product->getProductIDByProject($this->session->PRJ, false);
$products = $this->product->getByIdList($products);
}
else
+3
View File
@@ -1368,6 +1368,9 @@ class story extends control
$products = $this->product->getPairs();
$this->lang->set('menugroup.story', 'qa');
unset($this->lang->noMenuModule[6]);
$this->lang->navGroup->story = 'project';
$this->lang->story->menu = $this->lang->testcase->menu;
$this->lang->story->menuOrder = $this->lang->testcase->menuOrder;
$this->lang->story->menu->testcase['subModule'] = 'story';
+2 -1
View File
@@ -1,6 +1,7 @@
$(function()
{
if(typeof(storyType) == 'undefined') storyType = '';
if(typeof(resetActive) != 'undefined') return false;
if(typeof(storyType) == 'undefined') storyType = '';
$('#navbar .nav li').removeClass('active');
$("#navbar .nav li[data-id=" + storyType + ']').addClass('active');
})
+1
View File
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../testcase/view/caseheader.html.php';?>
<?php js::set('resetActive', false);?>
<div id='mainContent' class='main-control'>
<?php if(empty($stories)):?>
<div class="table-empty-tip">
+5
View File
@@ -27,6 +27,7 @@ class testcaseModel extends model
*/
public function setMenu($products, $productID, $branch = 0, $moduleID = 0, $suiteID = 0, $orderBy = 'id_desc')
{
$this->lang->product->menu = $this->lang->product->viewMenu;
$this->loadModel('product')->setMenu($products, $productID, $branch, $moduleID, 'case');
$selectHtml = $this->product->select($products, $productID, 'testcase', 'browse', '', $branch, $moduleID, 'case');
@@ -304,6 +305,7 @@ class testcaseModel extends model
return $this->dao->select('t1.*, t2.title as storyTitle')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->where('t1.product')->eq((int)$productID)
->andWhere('t1.PRJ')->eq($this->session->PRJ)
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi()
->beginIF($browseType == 'wait')->andWhere('t1.status')->eq($browseType)->fi()
@@ -332,6 +334,7 @@ class testcaseModel extends model
->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('t1.PRJ')->eq($this->session->PRJ)
->andWhere('t3.suite')->eq((int)$suiteID)
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi()
@@ -421,6 +424,7 @@ class testcaseModel extends model
{
$cases = $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_CASE)->alias('t1')->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->where("t2.status = 'active'")
->andWhere('t1.PRJ')->eq($this->session->PRJ)
->andWhere('t1.deleted')->eq(0)
->andWhere('t2.version > t1.storyVersion')
->andWhere('t1.product')->eq($productID)
@@ -1185,6 +1189,7 @@ class testcaseModel extends model
}
else
{
$caseData->PRJ = $this->session->PRJ;
$caseData->version = 1;
$caseData->openedBy = $this->app->user->account;
$caseData->openedDate = $now;
+1
View File
@@ -157,6 +157,7 @@ class testreportModel extends model
{
$objectID = (int)$objectID;
return $this->dao->select('*')->from(TABLE_TESTREPORT)->where('deleted')->eq(0)
->andWhere('PRJ')->eq($this->session->PRJ)
->beginIF($objectType == 'project')->andWhere('objectID')->eq($objectID)->andWhere('objectType')->eq('project')->fi()
->beginIF($objectType == 'product' and $extra)->andWhere('objectID')->eq((int)$extra)->andWhere('objectType')->eq('testtask')->fi()
->beginIF($objectType == 'product' and empty($extra))->andWhere('product')->eq($objectID)->fi()
+6
View File
@@ -143,6 +143,7 @@ class testsuiteModel extends model
{
return $this->dao->select("*")->from(TABLE_TESTSUITE)
->where('product')->eq((int)$productID)
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('deleted')->eq(0)
->andWhere("(`type` = 'public' OR (`type` = 'private' and addedBy = '{$this->app->user->account}'))")
->orderBy($orderBy)
@@ -251,6 +252,8 @@ class testsuiteModel extends model
$cases = $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)
->andWhere('t1.PRJ')->eq($this->session->PRJ)
->andWhere('t1.product')->eq($suite->product)
->andWhere('t1.product')->eq($suite->product)
->andWhere('t1.deleted')->eq(0)
->orderBy($orderBy)
@@ -293,6 +296,7 @@ class testsuiteModel extends model
$linkedCases = $this->getLinkedCases($suite->id, 'id_desc', null, $append = false);
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('id')->notIN(array_keys($linkedCases))
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->page($pager)
@@ -329,6 +333,7 @@ class testsuiteModel extends model
{
$importedCases = $this->dao->select('fromCaseID')->from(TABLE_CASE)
->where('product')->eq($productID)
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('lib')->eq($libID)
->andWhere('fromCaseID')->ne('')
->andWhere('deleted')->eq(0)
@@ -362,6 +367,7 @@ class testsuiteModel extends model
return $this->dao->select('*')->from(TABLE_CASE)->where('deleted')->eq(0)
->beginIF($browseType != 'bysearch')->andWhere('lib')->eq($libID)->fi()
->beginIF($browseType == 'bysearch')->andWhere($query)->fi()
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('product')->eq(0)
->andWhere('id')->notIN($importedCases)
->orderBy($orderBy)
+33 -63
View File
@@ -56,7 +56,7 @@ class testtask extends control
$this->session->set('testtaskList', $this->app->getURI(true));
$this->session->set('buildList', $this->app->getURI(true));
$scopeAndStatus = explode(',',$type);
$scopeAndStatus = explode(',', $type);
$this->session->set('testTaskVersionScope', $scopeAndStatus[0]);
$this->session->set('testTaskVersionStatus', $scopeAndStatus[1]);
@@ -153,34 +153,17 @@ class testtask extends control
if(!empty($_POST))
{
$taskID = $this->testtask->create();
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('testtask', $taskID, 'opened');
$this->executeHooks($taskID);
die(js::locate($this->createLink('testtask', 'browse', "productID=$productID"), 'parent'));
}
/* Create testtask from build of project.*/
if($projectID != 0 and $build != 0)
{
$products = $this->dao->select('t2.id, t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->where('t1.project')->eq($projectID)
->andWhere('t2.deleted')->eq(0)
->fetchPairs('id');
$productID = $productID ? $productID : key($products);
$projects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->andWhere('type')->ne('ops')->andWhere('deleted')->eq(0)->fetchPairs('id');
$builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->eq($build)->andWhere('deleted')->eq(0)->fetchPairs('id');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inLink('browse', "productID=$productID")));
}
/* Create testtask from testtask of test.*/
if($projectID == 0)
{
$projects = $this->loadModel('product')->getProjectPairs($productID, 0, $params = 'nodeleted');
$builds = $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk');
}
$productID = $productID ? $productID : key($this->products);
$projects = empty($productID) ? array() : $this->product->getProjectPairs($productID, 0, $params = 'nodeleted');
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true);
/* Set menu. */
$productID = $this->product->saveState($productID, $this->products);
@@ -191,17 +174,11 @@ class testtask extends control
$this->view->position[] = $this->lang->testtask->common;
$this->view->position[] = $this->lang->testtask->create;
if($projectID != 0)
{
$this->app->loadLang('build');
$this->view->products = $products;
$this->view->projectID = $projectID;
}
$this->view->projects = $projects;
$this->view->productID = $productID;
$this->view->builds = $builds;
$this->view->build = $build;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|qdfirst|nodeleted');
$this->view->projects = $projects;
$this->view->productID = $productID;
$this->view->builds = $builds;
$this->view->build = $build;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|qdfirst|nodeleted');
$this->display();
}
@@ -571,10 +548,14 @@ class testtask extends control
*/
public function edit($taskID)
{
/* Get task info. */
$task = $this->testtask->getById($taskID);
$productID = $this->product->saveState($task->product, $this->products);
if(!empty($_POST))
{
$changes = $this->testtask->update($taskID);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($changes or $this->post->comment)
{
$actionID = $this->loadModel('action')->create('testtask', $taskID, 'edited', $this->post->comment);
@@ -583,13 +564,9 @@ class testtask extends control
$this->executeHooks($taskID);
die(js::locate(inlink('view', "taskID=$taskID"), 'parent'));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
/* Get task info. */
$task = $this->testtask->getById($taskID);
$productID = $this->product->saveState($task->product, $this->products);
/* Set menu. */
$this->testtask->setMenu($this->products, $productID, $task->branch, $taskID);
@@ -598,9 +575,14 @@ class testtask extends control
$this->view->position[] = $this->lang->testtask->common;
$this->view->position[] = $this->lang->testtask->edit;
/* Create testtask from testtask of test.*/
$productID = $productID ? $productID : key($this->products);
$projects = empty($productID) ? array() : $this->product->getProjectPairs($productID, 0, $params = 'nodeleted');
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true);
$this->view->task = $task;
$this->view->projects = $this->product->getProjectPairs($productID);
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, $params = 'notrunk');
$this->view->projects = $projects;
$this->view->builds = $builds;
$this->view->users = $this->loadModel('user')->getPairs('nodeleted', $task->owner);
$this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote');
@@ -1153,13 +1135,6 @@ class testtask extends control
{
if($_POST)
{
$file = $this->loadModel('file')->getUpload('resultFile');
$file = $file[0];
$fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']);
move_uploaded_file($file['tmpname'], $fileName);
$this->session->set('resultFile', $fileName);
$taskID = $this->testtask->importUnitResult($productID);
if(dao::isError()) die(js::error(dao::getError()));
@@ -1170,22 +1145,17 @@ class testtask extends control
$this->testtask->setMenu($this->products, $productID);
$this->app->loadLang('job');
$projects = $this->dao->select('t2.id, t2.name')->from(TABLE_PROJECTPRODUCT)
->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t1.product')->eq((int)$productID)
->andWhere('t2.deleted')->eq(0)
->beginIF('0')->andWhere('t1.branch')->in('0')->fi()
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->projects)->fi()
->andWhere('t2.type')->ne('ops')
->orderBy('t1.project desc')
->fetchPairs('id', 'name');
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->importUnitResult;
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testtask->importUnitResult;
$productID = $productID ? $productID : key($this->products);
$projects = empty($productID) ? array() : $this->product->getProjectPairs($productID, 0, $params = 'nodeleted');
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk');
$this->view->projects = array('' => '') + $projects;
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk');
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->importUnitResult;
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testtask->importUnitResult;
$this->view->projects = $projects;
$this->view->builds = $builds;
$this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed');
$this->view->productID = $productID;
$this->display();
+1
View File
@@ -128,6 +128,7 @@ $lang->testtask->checkLinked = "Please check whether the product that the
$lang->testtask->noImportData = 'The imported XML does not parse the data.';
$lang->testtask->unitXMLFormat = 'Please select a file in JUnit XML format.';
$lang->testtask->titleOfAuto = "%s automated testing";
$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.';
$lang->testtask->assignedToMe = 'Meine';
$lang->testtask->allCases = 'Alle Fälle';
+1
View File
@@ -128,6 +128,7 @@ $lang->testtask->checkLinked = "Please check whether the product that the
$lang->testtask->noImportData = 'The imported XML does not parse the data.';
$lang->testtask->unitXMLFormat = 'Please select a file in JUnit XML format.';
$lang->testtask->titleOfAuto = "%s automated testing";
$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.';
$lang->testtask->assignedToMe = 'AssignedToMe';
$lang->testtask->allCases = 'All Cases';
+1
View File
@@ -128,6 +128,7 @@ $lang->testtask->checkLinked = "Vérifiez si le product auquel la campagne
$lang->testtask->noImportData = "Le XML importé ne parse pas les données.";
$lang->testtask->unitXMLFormat = 'Veuillez sélectionner un fichier au format XML JUnit.';
$lang->testtask->titleOfAuto = "%s tests automatisés";
$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.';
$lang->testtask->assignedToMe = 'Affecté à Moi';
$lang->testtask->allCases = 'Tous les CasTests';
+1
View File
@@ -128,6 +128,7 @@ $lang->testtask->checkLinked = "Vui lòng kiểm tra sản phẩm đó mà
$lang->testtask->noImportData = 'The imported XML does not parse the data.';
$lang->testtask->unitXMLFormat = 'Please select a file in JUnit XML format.';
$lang->testtask->titleOfAuto = "%s automated testing";
$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.';
$lang->testtask->assignedToMe = 'Giao cho bạn';
$lang->testtask->allCases = 'Tất cả tình huống';
+1
View File
@@ -128,6 +128,7 @@ $lang->testtask->checkLinked = '请检查测试单的产品是否与项目
$lang->testtask->noImportData = '导入的XML没有解析出数据。';
$lang->testtask->unitXMLFormat = '请选择Junit XML 格式的文件。';
$lang->testtask->titleOfAuto = "%s 自动化测试";
$lang->testtask->cannotBeParsed = '导入的XML文件内容格式错误,无法解析。';
$lang->testtask->assignedToMe = '指派给我';
$lang->testtask->allCases = '所有用例';
+1
View File
@@ -128,6 +128,7 @@ $lang->testtask->checkLinked = '請檢查測試單的產品是否與項目
$lang->testtask->noImportData = '導入的XML沒有解析出數據。';
$lang->testtask->unitXMLFormat = '請選擇Junit XML 格式的檔案。';
$lang->testtask->titleOfAuto = "%s 自動化測試";
$lang->testtask->cannotBeParsed = '導入的XML文件內容格式錯誤,無法解析。';
$lang->testtask->assignedToMe = '指派給我';
$lang->testtask->allCases = '所有用例';
+38 -5
View File
@@ -23,12 +23,13 @@ class testtaskModel extends model
*/
public function setMenu($products, $productID, $branch = 0, $testtask = 0)
{
$this->lang->product->menu = $this->lang->product->viewMenu;
$this->loadModel('product')->setMenu($products, $productID, $branch);
$selectHtml = $this->product->select($products, $productID, 'testtask', 'browse', '', $branch);
if($testtask and $this->app->viewType != 'mhtml')
{
$testtasks = $this->getProductTasks($productID, 0, 'id_desc', null, array('local', 'totalStatus'));
$testtasks = $this->getProductTasks($productID, 0, 'id_desc', null, array('local', 'totalStatus'), 0, 0, $this->session->PRJ);
if(!isset($testtasks[$testtask])) $testtasks[$testtask] = $this->getById($testtask);
$selectHtml .= "<div class='btn-group angle-btn'>";
@@ -186,14 +187,19 @@ class testtaskModel extends model
* Get test tasks of a product.
*
* @param int $productID
* @param int $branch
* @param string $orderBy
* @param object $pager
* @param array $scopeAndStatus
* @param int $beginTime
* @param int $endTime
* @access public
* @return array
*/
public function getProductTasks($productID, $branch = 0, $orderBy = 'id_desc', $pager = null, $scopeAndStatus = array(), $beginTime = 0, $endTime = 0)
{
$products = $scopeAndStatus[0] == 'all' ? $this->app->user->view->products : array();
return $this->dao->select("t1.*, t2.name AS productName, t3.name AS projectName, t4.name AS buildName, if(t4.name != '', t4.branch, t5.branch) AS branch")
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
@@ -202,8 +208,9 @@ class testtaskModel extends model
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.project = t5.project and t1.product = t5.product')
->where('t1.deleted')->eq(0)
->andWhere('t1.PRJ')->eq($this->session->PRJ)
->andWhere('t1.auto')->ne('unit')
->andWhere('t1.project')->in("0,{$this->app->user->view->sprints}") //Fix bug #3260.
->beginIF(!$this->app->user->admin)->andWhere('t3.id')->in("0,{$this->app->user->view->sprints}")->fi()
->beginIF($scopeAndStatus[0] == 'local')->andWhere('t1.product')->eq((int)$productID)->fi()
->beginIF($scopeAndStatus[0] == 'all')->andWhere('t1.product')->in($products)->fi()
->beginIF($scopeAndStatus[1] == 'totalStatus')->andWhere('t1.status')->in('blocked,doing,wait,done')->fi()
@@ -237,6 +244,7 @@ class testtaskModel extends model
->leftJoin(TABLE_BUILD)->alias('t4')->on('t1.build = t4.id')
->where('t1.deleted')->eq(0)
->andWhere('t1.product')->eq($productID)
->andWhere('t1.PRJ')->eq($this->session->PRJ)
->andWhere('t1.auto')->eq('unit')
->beginIF($browseType != 'all' and $browseType != 'newest' and $beginAndEnd)
->andWhere('t1.end')->ge($beginAndEnd['begin'])
@@ -426,6 +434,7 @@ class testtaskModel extends model
{
return $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('id')->notIN($linkedCases)
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('status')->ne('wait')
->andWhere('type')->ne('unit')
->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
@@ -452,7 +461,9 @@ class testtaskModel extends model
$cases = array();
if($stories)
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
$cases = $this->dao->select('*')->from(TABLE_CASE)
->where($query)
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('product')->eq($productID)
->andWhere('status')->ne('wait')
->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
@@ -485,6 +496,7 @@ class testtaskModel extends model
if($bugs)
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('product')->eq($productID)
->andWhere('status')->ne('wait')
->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
@@ -517,6 +529,7 @@ class testtaskModel extends model
return $this->dao->select('t1.*,t2.version as version')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case')
->where($query)
->andWhere('t1.PRJ')->eq($this->session->PRJ)
->andWhere('t2.suite')->eq((int)$suite)
->andWhere('t1.product')->eq($productID)
->andWhere('status')->ne('wait')
@@ -541,7 +554,12 @@ class testtaskModel extends model
{
$caseList = $this->dao->select("`case`")->from(TABLE_TESTRUN)->where('task')->eq($testTask)->andWhere('`case`')->notin($linkedCases)->fetchPairs('case');
return $this->dao->select("*")->from(TABLE_CASE)->where($query)->andWhere('id')->in($caseList)->andWhere('status')->ne('wait')->page($pager)->fetchAll();
return $this->dao->select("*")->from(TABLE_CASE)->where($query)
->andWhere('id')->in($caseList)
->andWhere('PRJ')->eq($this->session->PRJ)
->andWhere('status')->ne('wait')
->page($pager)
->fetchAll();
}
/**
@@ -1595,10 +1613,25 @@ class testtaskModel extends model
*/
public function importUnitResult($productID)
{
$file = $this->loadModel('file')->getUpload('resultFile');
if(empty($file))
{
dao::$errors[] = $this->lang->testtask->unitXMLFormat;
die(js::error(dao::getError()));
}
$file = $file[0];
$fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']);
move_uploaded_file($file['tmpname'], $fileName);
if(simplexml_load_file($fileName) === false)
{
dao::$errors[] = $this->lang->testtask->cannotBeParsed;
die(js::error(dao::getError()));
}
$frame = $this->post->frame;
unset($_POST['frame']);
$fileName = $this->session->resultFile;
$data = $this->parseXMLResult($fileName, $productID, $frame);
if($frame == 'cppunit' and empty($data['cases'])) $data = $this->parseCppXMLResult($fileName, $productID, $frame);
+1 -1
View File
@@ -19,7 +19,7 @@
<div class='main-header'>
<h2><?php echo $lang->testtask->create;?></h2>
</div>
<form method='post' target='hiddenwin' id='dataform'>
<form method='post' class="main-form form-ajax" enctype="multipart/form-data" id='dataform'>
<table class='table table-form'>
<?php if(isset($projectID)):?>
<tr>
+2 -2
View File
@@ -22,8 +22,8 @@
<small class='text-muted'><?php echo $lang->arrow . $lang->testtask->edit;?></small>
</h2>
</div>
<form method='post' target='hiddenwin' id='dataform'>
<table class='table table-form'>
<form method='post' class="main-form form-ajax" enctype="multipart/form-data" id='dataform'>
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo $lang->testtask->project;?></th>
<td class='w-p35-f'>