This commit is contained in:
hufangzhou
2021-08-27 15:13:51 +08:00
17 changed files with 116 additions and 15 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
/**
* 禅道API的todo资源类
* 版本V1
*
* The testcase entry point of zentaopms
* Version 1
*/
class testcaseEntry extends entry
{
public function get($testcaseID)
{
$control = $this->loadController('testcase', 'view');
$control->view($testcaseID, $this->param('version', 0));
$data = $this->getData();
if(!$data or (isset($data->message) and $data->message == '404 Not found')) return $this->send404();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
if(!isset($data->case)) $this->sendError(400, 'error');
$this->send(200, $this->format($data->case, 'openedDate:time,lastEditedDate:time,lastRunDate:time'));
}
public function delete($testcaseID)
{
$control = $this->loadController('testcase', 'delete');
$control->delete($testcaseID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
/**
* 禅道API的testcases资源类
* 版本V1
*
* The testcases entry point of zentaopms
* Version 1
*/
class testcasesEntry extends entry
{
public function get()
{
$this->app->loadClass('pager', $static = true);
$pager = pager::init($this->param('total', 0), $this->param('limit', 20), $this->param('page', 1));
$testcases = $this->loadModel('testcase')->getByStatus($this->param('productID', 0), $this->param('branch', ''), $this->param('type', 'all'), $this->param('status', 'all'), $this->param('moduleID', 0), $this->param('order', 'id_desc'), $pager, $this->param('auto', 'no'));
$result = array();
foreach($testcases as $testcase)
{
$result[] = $this->format($testcase, 'openedDate:time,lastEditedDate:time,lastRunDate:time');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'testcases' => $result));
}
}
+3
View File
@@ -50,6 +50,9 @@ $routes['/issues/:issueID'] = 'issue';
$routes['/todos'] = 'todos';
$routes['/todos/:id'] = 'todo';
$routes['/testcases'] = 'testcases';
$routes['/testcases/:id'] = 'testcase';
$routes['/projects/:projectID/testtasks'] = 'testtasks';
$routes['/testtasks'] = 'testtasks';
$routes['/testtasks/:id'] = 'testtask';
+3 -3
View File
@@ -612,9 +612,9 @@ class baseRouter
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') $httpType = 'https';
if(isset($_SERVER['REQUEST_SCHEME']) and strtolower($_SERVER['REQUEST_SCHEME']) == 'https') $httpType = 'https';
$httpHost = $_SERVER['HTTP_HOST'];
$isAPI = (defined('RUN_MODE') && RUN_MODE == 'api') || isset($_GET[$this->config->sessionVar]);
if(!$isAPI && strpos($this->server->http_referer, "$httpType://$httpHost") !== 0) $_FILES = $_POST = array();
$httpHost = zget($_SERVER, 'HTTP_HOST', '');
$apiMode = (defined('RUN_MODE') && RUN_MODE == 'api') || isset($_GET[$this->config->sessionVar]);
if(!$apiMode && (empty($httpHost) or strpos($this->server->http_referer, "$httpType://$httpHost") !== 0)) $_FILES = $_POST = array();
}
$_FILES = validater::filterFiles();
+1 -1
View File
@@ -35,7 +35,7 @@ class control extends baseControl
$this->app->setOpenApp();
if(defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE == 'api')) $this->setPreference();
if(defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE != 'api')) $this->setPreference();
if(!isset($this->config->bizVersion)) return false;
+1 -1
View File
@@ -489,7 +489,7 @@ class baseHTML
{
if(helper::inOnlyBodyMode()) return false;
global $lang, $app;
global $lang, $app, $config;
if(empty($label))
{
global $lang, $config;
+1 -1
View File
@@ -270,7 +270,7 @@ $lang->lang = 'Sprache';
/* Theme style. */
$lang->theme = 'Theme';
$lang->themes['default'] = 'ZenTao Blau (Standard)';
$lang->themes['blue'] = 'Blau';
$lang->themes['blue'] = 'Young Blue';
$lang->themes['green'] = 'Grün';
$lang->themes['red'] = 'Rot';
$lang->themes['purple'] = 'Lila';
+1 -1
View File
@@ -307,7 +307,7 @@ $lang->lang = 'Language';
/* Theme style. */
$lang->theme = 'Theme';
$lang->themes['default'] = 'Default';
$lang->themes['blue'] = 'Blue';
$lang->themes['blue'] = 'Young Blue';
$lang->themes['green'] = 'Green';
$lang->themes['red'] = 'Red';
$lang->themes['purple'] = 'Purple';
+1 -1
View File
@@ -270,7 +270,7 @@ $lang->lang = 'Langue';
/* Theme style. */
$lang->theme = 'Theme';
$lang->themes['default'] = 'Default';
$lang->themes['blue'] = 'Blue';
$lang->themes['blue'] = 'Young Blue';
$lang->themes['green'] = 'Green';
$lang->themes['red'] = 'Red';
$lang->themes['purple'] = 'Purple';
+1 -1
View File
@@ -270,7 +270,7 @@ $lang->lang = 'Ngôn ngữ';
/* Theme style. */
$lang->theme = 'Theme';
$lang->themes['default'] = 'Mặc định';
$lang->themes['blue'] = 'Blue';
$lang->themes['blue'] = 'Young Blue';
$lang->themes['green'] = 'Green';
$lang->themes['red'] = 'Red';
$lang->themes['purple'] = 'Purple';
+1 -1
View File
@@ -32,7 +32,7 @@
</tr>
<tr>
<th><?php echo $lang->job->engine; ?></th>
<td class='required'>
<td>
<div class='table-row'>
<div class='table-col'><?php echo html::select('engine', $lang->job->engineList, '', "class='form-control chosen'"); ?></div>
</div>
+1
View File
@@ -402,6 +402,7 @@ class my extends control
{
$uri = $this->app->getURI(true);
$this->session->set('testtaskList', $uri, 'qa');
$this->session->set('reportList', $uri, 'qa');
$this->session->set('buildList', $uri, 'execution');
}
+1
View File
@@ -70,6 +70,7 @@ class program extends control
public function kanban()
{
$this->app->loadLang('release');
$this->app->session->set('projectList', $this->app->getURI(true), 'project');
$this->view->title = $this->lang->program->kanban->common;
$this->view->kanbanGroup = $this->program->getKanbanGroup();
-3
View File
@@ -1636,9 +1636,6 @@ class storyModel extends model
if(empty($oldPlanID)) $story->plan = $planID;
if($oldStory->branch) $story->plan = $planID;
/* Append the plan id to plan field if product is multi and story is all branch. */
if($this->session->currentProductType != 'normal' and empty($story->branch)) $story->plan .= ",$planID";
/* Change stage. */
if($planID and $oldStory->stage == 'wait') $story->stage = 'planned';
if($planID and $this->session->currentProductType != 'normal' and $oldStory->branch == 0)
+7 -1
View File
@@ -600,7 +600,11 @@ class testcase extends control
{
$caseID = (int)$caseID;
$case = $this->testcase->getById($caseID, $version);
if(!$case) die(js::error($this->lang->notFound) . js::locate('back'));
if(!$case)
{
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => '404 Not found'));
die(js::error($this->lang->notFound) . js::locate('back'));
}
if($case->auto == 'unit')
{
$this->lang->testcase->subMenu->testcase->feature['alias'] = '';
@@ -681,6 +685,7 @@ class testcase extends control
$this->view->isLibCase = $isLibCase;
$this->view->caseFails = $caseFails;
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success', 'case' => $case));
$this->display();
}
@@ -1017,6 +1022,7 @@ class testcase extends control
}
$locateLink = $this->session->caseList ? $this->session->caseList : inlink('browse', "productID={$case->product}");
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success'));
die(js::locate($locateLink, 'parent'));
}
}
+33
View File
@@ -571,6 +571,39 @@ class testcaseModel extends model
->orderBy($orderBy)->page($pager)->fetchAll();
}
/**
* Get cases by type
*
* @param int $productID
* @param int $branch
* @param string $type all|needconfirm
* @param string $status all|normal|blocked|investigate
* @param int $moduleID
* @param string $orderBy
* @param object $pager
* @param string $auto no|unit|skip
* @access public
* @return array
*/
public function getByStatus($productID = 0, $branch, $type = 'all', $status = 'all', $moduleID, $orderBy = 'id_desc', $pager, $auto = 'no')
{
$modules = $moduleID ? $this->loadModel('tree')->getAllChildId($moduleID) : '0';
$cases = $this->dao->select('t1.*, t2.title as storyTitlen')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->beginIF($productID)->where('t1.product')->eq((int) $productID)->fi()
->beginIF($productID == 0)->where('t1.product')->in($this->app->user->view->products)->fi()
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($modules)->andWhere('t1.module')->in($modules)->fi()
->beginIF($type == 'needconfirm')->andWhere("t2.status = 'active'")->andWhere('t2.version > t1.storyVersion')->fi()
->beginIF($status != 'all')->andWhere('t1.status')->eq($status)->fi()
->beginIF($auto == 'unit')->andWhere('t1.auto')->eq('unit')->fi()
->beginIF($auto != 'unit')->andWhere('t1.auto')->ne('unit')->fi()
->andWhere('t1.deleted')->eq('0')
->orderBy($orderBy)->page($pager)->fetchAll('id');
return $this->appendData($cases);
}
/**
* Get cases of a story.
*
+2 -1
View File
@@ -89,7 +89,6 @@ class testreport extends control
public function browse($objectID = 0, $objectType = 'product', $extra = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
if(strpos('product|execution|project', $objectType) === false) die('Type Error!');
$this->session->set('reportList', $this->app->getURI(true), $this->app->openApp);
$objectID = $this->commonAction($objectID, $objectType);
$object = $this->$objectType->getById($objectID);
@@ -127,6 +126,8 @@ class testreport extends control
if($param) $this->locate($this->createLink('testreport', 'create', $param));
}
$this->session->set('reportList', $this->app->getURI(true), $this->app->openApp);
$executions = array();
$tasks = array();
foreach($reports as $report)