* code for task #44332.
This commit is contained in:
@@ -33,6 +33,10 @@ class executionEntry extends Entry
|
||||
}
|
||||
|
||||
$execution = $this->format($data->data->execution, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool');
|
||||
|
||||
$this->app->loadConfig('testcase');
|
||||
$execution->caseReview = ($config->testcase->needReview or !empty($config->testcase->forceReview));
|
||||
|
||||
if(!$fields) $this->send(200, $execution);
|
||||
|
||||
/* Set other fields. */
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* The execution cases entry point of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package entries
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class executionCasesEntry extends entry
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get($executionID = 0)
|
||||
{
|
||||
if(!$executionID) $executionID = $this->param('execution', 0);
|
||||
if(empty($executionID)) return $this->sendError(400, 'Need execution id.');
|
||||
|
||||
$control = $this->loadController('execution', 'testcase');
|
||||
$control->testcase($executionID, $this->param('status', 'all'), $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
|
||||
|
||||
$data = $this->getData();
|
||||
|
||||
if(isset($data->status) and $data->status == 'success')
|
||||
{
|
||||
$cases = $data->data->cases;
|
||||
$pager = $data->data->pager;
|
||||
$result = array();
|
||||
foreach($cases as $case)
|
||||
{
|
||||
$case->status = array('code' => $case->status, 'name' => $this->lang->testcase->statusList[$case->status]);
|
||||
$result[] = $this->format($case, 'openedDate:time,reviewedDate:date,lastEditedDate:time,lastRunDate:time');
|
||||
}
|
||||
|
||||
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'cases' => $result));
|
||||
}
|
||||
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -83,9 +83,10 @@ $routes['/projects/:projectID/builds'] = 'builds';
|
||||
$routes['/builds'] = 'builds';
|
||||
$routes['/builds/:id'] = 'build';
|
||||
|
||||
$routes['/products/:id/testcases'] = 'testcases';
|
||||
$routes['/testcases'] = 'testcases';
|
||||
$routes['/testcases/:id'] = 'testcase';
|
||||
$routes['/products/:id/testcases'] = 'testcases';
|
||||
$routes['/executions/:id/testcases'] = 'executioncases';
|
||||
$routes['/testcases'] = 'testcases';
|
||||
$routes['/testcases/:id'] = 'testcase';
|
||||
|
||||
$routes['/projects/:projectID/testtasks'] = 'testtasks';
|
||||
$routes['/testtasks'] = 'testtasks';
|
||||
|
||||
@@ -302,12 +302,27 @@ class testcaseModel extends model
|
||||
* @param int $executionID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $browseType
|
||||
* @param string $browseType all|wait|needconfirm
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getExecutionCases($executionID, $orderBy = 'id_desc', $pager = null, $browseType = '')
|
||||
{
|
||||
if($browseType == 'needconfirm')
|
||||
{
|
||||
return $this->dao->select('distinct t1.*, t2.*')->from(TABLE_PROJECTCASE)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id')
|
||||
->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
|
||||
->where('t1.project')->eq((int)$executionID)
|
||||
->beginIF($browseType != 'all')->andWhere('t2.status')->eq($browseType)->fi()
|
||||
->andWhere('t2.deleted')->eq('0')
|
||||
->andWhere('t3.version > t2.storyVersion')
|
||||
->andWhere("t3.status")->eq('active')
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
return $this->dao->select('distinct t1.*, t2.*')->from(TABLE_PROJECTCASE)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id')
|
||||
->where('t1.project')->eq((int)$executionID)
|
||||
@@ -1701,6 +1716,13 @@ class testcaseModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary cases
|
||||
*
|
||||
* @param array $cases
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function summary($cases)
|
||||
{
|
||||
$executed = 0;
|
||||
|
||||
Reference in New Issue
Block a user