+ Add qa, bug, testcase, testtask of project module.

This commit is contained in:
zhujinyong
2021-03-21 17:44:25 +08:00
parent 6582a700bb
commit 4ebd5e6cc1
10 changed files with 692 additions and 12 deletions
+176
View File
@@ -664,6 +664,182 @@ class project extends control
$this->locate($this->createLink('execution', 'all', "status=all&projectID=$projectID", '', false));
}
/**
* Project qa dashboard.
*
* @param int $projectID
* @access public
* @return void
*/
public function qa($projectID = 0)
{
$this->project->setMenu($projectID);
$this->view->title = $this->lang->project->qa;
$this->display();
}
/**
* Project bug list.
*
* @param int $projectID
* @param string $orderBy
* @param int $build
* @param string $type
* @param int $param
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function bug($projectID = 0, $orderBy = 'status,id_desc', $build = 0, $type = 'all', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Load these two models. */
$this->loadModel('bug');
$this->loadModel('user');
/* Save session. */
$this->session->set('bugList', $this->app->getURI(true), 'qa');
$this->project->setMenu($projectID);
$project = $this->project->getByID($projectID);
$type = strtolower($type);
$queryID = ($type == 'bysearch') ? (int)$param : 0;
$products = $this->project->getProducts($projectID);
$productID = key($products); // Get the first product for creating bug.
$branchID = isset($products[$productID]) ? $products[$productID]->branch : 0;
/* Header and position. */
$title = $project->name . $this->lang->colon . $this->lang->bug->common;
$position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name);
$position[] = $this->bug->common;
/* Load pager and get bugs, user. */
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$sort = $this->loadModel('common')->appendOrder($orderBy);
$bugs = $this->bug->getProjectBugs($projectID, $build, $type, $param, $sort, '', $pager);
$users = $this->user->getPairs('noletter');
/* team member pairs. */
$memberPairs = array();
$memberPairs[] = "";
foreach($this->view->teamMembers as $key => $member)
{
$memberPairs[$key] = $member->realname;
}
/* Build the search form. */
$actionURL = $this->createLink('project', 'bug', "projectID=$projectID&orderBy=$orderBy&build=$build&type=bysearch&queryID=myQueryID");
$this->execution->buildBugSearchForm($products, $queryID, $actionURL);
/* Assign. */
$this->view->title = $title;
$this->view->position = $position;
$this->view->bugs = $bugs;
$this->view->tabID = 'bug';
$this->view->build = $this->loadModel('build')->getById($build);
$this->view->buildID = $this->view->build ? $this->view->build->id : 0;
$this->view->pager = $pager;
$this->view->orderBy = $orderBy;
$this->view->users = $users;
$this->view->productID = $productID;
$this->view->branchID = empty($this->view->build->branch) ? $branchID : $this->view->build->branch;
$this->view->memberPairs = $memberPairs;
$this->view->type = $type;
$this->view->param = $param;
$this->display();
}
/**
* Project case list.
*
* @param int $projectID
* @param string $type
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function testcase($projectID = 0, $type = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->loadModel('testcase');
$this->loadModel('testtask');
$this->project->setMenu($projectID);
$products = $this->project->getProducts($projectID);
$productID = key($products); // Get the first product for creating testcase.
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$cases = $this->loadModel('testcase')->getProjectCases($projectID, $orderBy, $pager, $type);
$cases = $this->testcase->appendData($cases, 'run');
$this->view->title = $this->lang->execution->testcase;
$this->view->projectID = $projectID;
$this->view->productID = $productID;
$this->view->cases = $cases;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->type = $type;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->execution = $this->execution->getByID($executionID);
$this->display();
}
/**
* Project test task list.
*
* @param int $projectID
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function testtask($projectID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->loadModel('testtask');
/* Save session. */
$this->session->set('testtaskList', $this->app->getURI(true), 'qa');
$this->project->setMenu($projectID);
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$productTasks = array();
$project = $this->project->getByID($projectID);
$tasks = $this->testtask->getProjectTasks($projectID, $orderBy, $pager);
foreach($tasks as $key => $task) $productTasks[$task->product][] = $task;
$this->view->title = $project->name . $this->lang->colon . $this->lang->project->common;
$this->view->position[] = html::a($this->createLink('project', 'testtask', "projectID=$projectID"), $project->name);
$this->view->position[] = $this->lang->testtask->common;
$this->view->project = $project;
$this->view->projectID = $projectID;
$this->view->projectName = $project->name;
$this->view->pager = $pager;
$this->view->orderBy = $orderBy;
$this->view->tasks = $productTasks;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->view->products = $this->loadModel('product')->getPairs('', 0);
$this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable.
$this->display();
}
/**
* Browse builds of a project.
*