* Refactor testsuite unlinkCase method.
This commit is contained in:
@@ -68,23 +68,26 @@ $app->loadModuleConfig('testcase');
|
||||
|
||||
$config->testsuite->testcase = new stdclass();
|
||||
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['icon'] = 'unlink';
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['text'] = $lang->testtask->unlinkCase;
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['hint'] = $lang->testtask->unlinkCase;
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['url'] = array('module' => 'testsuite', 'method' => 'unlinkCase', 'params' => 'suiteID={suite}&caseID={id}&confirm=yes');
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['className'] = 'ajax-submit';
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['icon'] = 'unlink';
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['text'] = $lang->testtask->unlinkCase;
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['hint'] = $lang->testtask->unlinkCase;
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['url'] = array('module' => 'testsuite', 'method' => 'unlinkCase', 'params' => 'suiteID={suite}&caseID={id}&confirm=yes');
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['className'] = 'ajax-submit';
|
||||
$config->testsuite->testcase->actionList['unlinkCase']['data-confirm'] = $lang->testsuite->confirmUnlinkCase;
|
||||
|
||||
$config->testsuite->testcase->actionList['runCase']['icon'] = 'play';
|
||||
$config->testsuite->testcase->actionList['runCase']['text'] = $lang->testtask->runCase;
|
||||
$config->testsuite->testcase->actionList['runCase']['hint'] = $lang->testtask->runCase;
|
||||
$config->testsuite->testcase->actionList['runCase']['url'] = array('module' => 'testtask', 'method' => 'runCase', 'params' => 'runID=0&caseID={id}&version={version}');
|
||||
$config->testsuite->testcase->actionList['runCase']['data-toggle'] = 'modal';
|
||||
$config->testsuite->testcase->actionList['runCase']['data-size'] = 'lg';
|
||||
|
||||
$config->testsuite->testcase->actionList['runResult']['icon'] = 'list-alt';
|
||||
$config->testsuite->testcase->actionList['runResult']['text'] = $lang->testtask->results;
|
||||
$config->testsuite->testcase->actionList['runResult']['hint'] = $lang->testtask->results;
|
||||
$config->testsuite->testcase->actionList['runResult']['url'] = array('module' => 'testtask', 'method' => 'results', 'params' => 'runID=0&caseID={id}');
|
||||
$config->testsuite->testcase->actionList['runResult']['data-toggle'] = 'modal';
|
||||
$config->testsuite->testcase->actionList['runResult']['data-size'] = 'lg';
|
||||
|
||||
$config->testsuite->testcase->dtable = new stdclass();
|
||||
|
||||
|
||||
@@ -241,6 +241,9 @@ class testsuite extends control
|
||||
public function edit(int $suiteID)
|
||||
{
|
||||
$suite = $this->testsuite->getById($suiteID);
|
||||
|
||||
if($suite->type == 'private' and $suite->addedBy != $this->app->user->account and !$this->app->user->admin) return $this->send(array('result' => 'fail', 'message' => $this->lang->error->accessDenied, 'load' => array('locate' => inlink('browse'))));
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$response = array();
|
||||
@@ -270,8 +273,6 @@ class testsuite extends control
|
||||
return $this->send($response);
|
||||
}
|
||||
|
||||
if($suite->type == 'private' and $suite->addedBy != $this->app->user->account and !$this->app->user->admin) return print(js::error($this->lang->error->accessDenied) . js::locate('back'));
|
||||
|
||||
/* 设置1.5级菜单。 */
|
||||
/* Set product session. */
|
||||
$productID = $this->product->saveState($suite->product, $this->products);
|
||||
@@ -390,19 +391,12 @@ class testsuite extends control
|
||||
*/
|
||||
public function unlinkCase(int $suiteID, int $caseID, string $confirm = 'no')
|
||||
{
|
||||
if($confirm == 'no')
|
||||
$this->testsuite->deleteCaseBysuiteID(array($caseID), $suiteID);
|
||||
if(dao::isError())
|
||||
{
|
||||
return print(js::confirm($this->lang->testsuite->confirmUnlinkCase, $this->createLink('testsuite', 'unlinkCase', "caseID={$caseID}&confirm=yes")));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->testsuite->deleteCaseBysuiteID(array($caseID), $suiteID);
|
||||
if(dao::isError())
|
||||
{
|
||||
return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
}
|
||||
return $this->send(array('result' => 'success', 'message' => '', 'load' => true));
|
||||
return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
}
|
||||
return $this->send(array('result' => 'success', 'message' => '', 'load' => true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user