diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 368ff461c5..c16e47f77c 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1161,6 +1161,7 @@ $lang->resource->testcase->updateOrder = 'updateOrder'; $lang->resource->testcase->importXmind = 'importXmind'; $lang->resource->testcase->exportXmind = 'exportXmind'; +$lang->resource->testcase->exportFreeMind = 'exportFreeMind'; $lang->testcase->methodOrder[0] = 'index'; $lang->testcase->methodOrder[5] = 'browse'; diff --git a/module/group/packagemanager.php b/module/group/packagemanager.php index bfe427960a..98d100a1f9 100644 --- a/module/group/packagemanager.php +++ b/module/group/packagemanager.php @@ -1872,12 +1872,13 @@ $config->group->package->importCase = new stdclass(); $config->group->package->importCase->order = 25; $config->group->package->importCase->subset = 'testcase'; $config->group->package->importCase->privs = array(); -$config->group->package->importCase->privs['testcase-export'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd', 'order' => 0, 'depend' => array(), 'recommend' => array('testcase-exportXmind')); +$config->group->package->importCase->privs['testcase-export'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd', 'order' => 0, 'depend' => array(), 'recommend' => array('testcase-exportXmind', 'testcase-exportFreeMind')); $config->group->package->importCase->privs['testcase-importFromLib'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd', 'order' => 5, 'depend' => array(), 'recommend' => array('assetlib-caselib', 'caselib-browse')); $config->group->package->importCase->privs['testcase-exportTemplate'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd', 'order' => 1, 'depend' => array('testcase-import'), 'recommend' => array()); $config->group->package->importCase->privs['testcase-import'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd', 'order' => 3, 'depend' => array('testcase-exportTemplate'), 'recommend' => array('testcase-importXmind')); $config->group->package->importCase->privs['testcase-importXmind'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd', 'order' => 6, 'depend' => array(), 'recommend' => array('testcase-import')); $config->group->package->importCase->privs['testcase-exportXmind'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd', 'order' => 2, 'depend' => array(), 'recommend' => array('testcase-export')); +$config->group->package->importCase->privs['testcase-exportFreeMind'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd', 'order' => 2, 'depend' => array(), 'recommend' => array('testcase-export')); $config->group->package->deleteCase = new stdclass(); $config->group->package->deleteCase->order = 30; diff --git a/module/testcase/control.php b/module/testcase/control.php index cb4f7d0656..7e56d02a2a 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -1704,17 +1704,17 @@ class testcase extends control * @access public * @return void */ - public function exportXMind(int $productID, int $moduleID, string $branch) + public function exportFreeMind(int $productID, int $moduleID, string $branch) { if($_POST) { - $configList = $this->testcaseZen->buildXmindConfig(); + $configList = $this->testcaseZen->buildMindConfig('freemind'); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->testcase->saveXmindConfig($configList); $imoduleID = $this->post->imodule ? $this->post->imodule : 0; - $context = $this->testcaseZen->getXmindExport($productID, (int)$imoduleID, $branch); + $context = $this->testcaseZen->getMindExport('freemind', $productID, (int)$imoduleID, $branch); $productName = ''; if(count($context['caseList'])) @@ -1730,12 +1730,14 @@ class testcase extends control $xmlDoc = $this->testcaseZen->createXmlDoc($productID, $productName, $context); $xmlStr = $xmlDoc->saveXML(); + a($xmlStr); + die; $this->fetch('file', 'sendDownHeader', array('fileName' => $productName, 'mm', $xmlStr)); } $product = $this->product->getByID($productID); - $this->view->settings = $this->testcase->getXmindConfig(); + $this->view->settings = $this->testcase->getMindConfig('freemind'); $this->view->productName = $product->name; $this->view->moduleID = $moduleID; $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, 'case', 0, ($branch === 'all' || !isset($branches[$branch])) ? '0' : $branch); @@ -1752,7 +1754,7 @@ class testcase extends control */ public function getXmindConfig() { - $result = $this->testcase->getXmindConfig(); + $result = $this->testcase->getMindConfig('xmind'); $this->send($result); } @@ -1798,7 +1800,7 @@ class testcase extends control /* 保存xmind配置。*/ /* Sav xmind config. */ - $configList = $this->testcaseZen->buildXmindConfig(); + $configList = $this->testcaseZen->buildMindConfig('xmind'); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->testcase->saveXmindConfig($configList); @@ -1813,7 +1815,7 @@ class testcase extends control return $this->send(array('result' => 'success', 'load' => $this->createLink('testcase', 'showXmindImport', "productID=$result&branch=$branch"), 'closeModal' => true)); } - $this->view->settings = $this->testcase->getXmindConfig(); + $this->view->settings = $this->testcase->getMindConfig('xmind'); $this->display(); } @@ -1880,7 +1882,7 @@ class testcase extends control if(!empty($results[0]['rootTopic'])) $scenes = $this->testcaseZen->processScene($results[0]['rootTopic']); $this->view->title = $this->lang->testcase->xmindImport; - $this->view->settings = $this->testcase->getXmindConfig(); + $this->view->settings = $this->testcase->getMindConfig('xmind'); $this->view->product = $product; $this->view->productID = $productID; $this->view->branch = $branch; diff --git a/module/testcase/lang/de.php b/module/testcase/lang/de.php index 765bb84ff6..a5bdc082e7 100644 --- a/module/testcase/lang/de.php +++ b/module/testcase/lang/de.php @@ -287,6 +287,7 @@ $lang->testcase->featureBar['browse']['needconfirm'] = $lang->testcase->needConf $lang->testcase->importXmind = "Import Xmind"; $lang->testcase->exportXmind = "Export Xmind"; +$lang->testcase->exportFreeMind = "Export FreeMind"; $lang->testcase->getXmindImport = "Get Mindmap"; $lang->testcase->showXMindImport = "Display Mindmap"; $lang->testcase->saveXmindImport = "Save Mindmap"; @@ -300,7 +301,7 @@ $lang->testcase->errorFileFormat = 'File format error'; $lang->testcase->moduleSelector = 'Module Selection'; $lang->testcase->errorImportBadProduct = 'Product does not exist, import error'; $lang->testcase->errorSceneNotExist = 'Scene [%d] not exists'; -$lang->testcase->errorXmindConfig = "%s characteristic character can only be 1-10 letters."; +$lang->testcase->errorMindConfig = "%s characteristic character can only be 1-10 letters."; $lang->testcase->save = 'Save'; $lang->testcase->close = 'Close'; @@ -312,6 +313,7 @@ $lang->testcase->xmindSettingTip = 'After the feature characters are set, the $lang->testcase->settingModule = 'Module'; $lang->testcase->settingScene = 'Scene'; $lang->testcase->settingCase = 'Testcase'; +$lang->testcase->settingPre = 'Precondition'; $lang->testcase->settingPri = 'Priority'; $lang->testcase->settingGroup = 'Step Group'; diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php index e9013934df..578985ab32 100644 --- a/module/testcase/lang/en.php +++ b/module/testcase/lang/en.php @@ -287,6 +287,7 @@ $lang->testcase->featureBar['browse']['needconfirm'] = $lang->testcase->needConf $lang->testcase->importXmind = "Import Xmind"; $lang->testcase->exportXmind = "Export Xmind"; +$lang->testcase->exportFreeMind = "Export FreeMind"; $lang->testcase->getXmindImport = "Get Mindmap"; $lang->testcase->showXMindImport = "Display Mindmap"; $lang->testcase->saveXmindImport = "Save Mindmap"; @@ -300,7 +301,7 @@ $lang->testcase->errorFileFormat = 'File format error'; $lang->testcase->moduleSelector = 'Module Selection'; $lang->testcase->errorImportBadProduct = 'Product does not exist, import error'; $lang->testcase->errorSceneNotExist = 'Scene [%d] not exists'; -$lang->testcase->errorXmindConfig = "%s characteristic character can only be 1-10 letters."; +$lang->testcase->errorMindConfig = "%s characteristic character can only be 1-10 letters."; $lang->testcase->save = 'Save'; $lang->testcase->close = 'Close'; @@ -312,6 +313,7 @@ $lang->testcase->xmindSettingTip = 'After the feature characters are set, the $lang->testcase->settingModule = 'Module'; $lang->testcase->settingScene = 'Scene'; $lang->testcase->settingCase = 'Testcase'; +$lang->testcase->settingPre = 'Precondition'; $lang->testcase->settingPri = 'Priority'; $lang->testcase->settingGroup = 'Step Group'; diff --git a/module/testcase/lang/fr.php b/module/testcase/lang/fr.php index 5f984bf5aa..e43eb4b3a3 100644 --- a/module/testcase/lang/fr.php +++ b/module/testcase/lang/fr.php @@ -287,6 +287,7 @@ $lang->testcase->featureBar['browse']['needconfirm'] = $lang->testcase->needConf $lang->testcase->importXmind = "Import Xmind"; $lang->testcase->exportXmind = "Export Xmind"; +$lang->testcase->exportFreeMind = "Export FreeMind"; $lang->testcase->getXmindImport = "Get Mindmap"; $lang->testcase->showXMindImport = "Display Mindmap"; $lang->testcase->saveXmindImport = "Save Mindmap"; @@ -300,7 +301,7 @@ $lang->testcase->errorFileFormat = 'File format error'; $lang->testcase->moduleSelector = 'Module Selection'; $lang->testcase->errorImportBadProduct = 'Product does not exist, import error'; $lang->testcase->errorSceneNotExist = 'Scene [%d] not exists'; -$lang->testcase->errorXmindConfig = "%s characteristic character can only be 1-10 letters."; +$lang->testcase->errorMindConfig = "%s characteristic character can only be 1-10 letters."; $lang->testcase->save = 'Save'; $lang->testcase->close = 'Close'; @@ -312,6 +313,7 @@ $lang->testcase->xmindSettingTip = 'After the feature characters are set, the $lang->testcase->settingModule = 'Module'; $lang->testcase->settingScene = 'Scene'; $lang->testcase->settingCase = 'Testcase'; +$lang->testcase->settingPre = 'Precondition'; $lang->testcase->settingPri = 'Priority'; $lang->testcase->settingGroup = 'Step Group'; diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index 97859f6e71..24141dd298 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -287,6 +287,7 @@ $lang->testcase->featureBar['browse']['needconfirm'] = $lang->testcase->needConf $lang->testcase->importXmind = "导入Xmind"; $lang->testcase->exportXmind = "导出Xmind"; +$lang->testcase->exportFreeMind = "导出FreeMind"; $lang->testcase->getXmindImport = "获取导图"; $lang->testcase->showXMindImport = "显示导图"; $lang->testcase->saveXmindImport = "保存导图"; @@ -300,7 +301,7 @@ $lang->testcase->errorFileFormat = '文件格式错误'; $lang->testcase->moduleSelector = '模块选择'; $lang->testcase->errorImportBadProduct = '产品不存在,导入错误'; $lang->testcase->errorSceneNotExist = '场景[%d]不存在'; -$lang->testcase->errorXmindConfig = "%s特征字符串只能是1-10个字母"; +$lang->testcase->errorMindConfig = "%s特征字符串只能是1-10个字母"; $lang->testcase->save = '保存'; $lang->testcase->close = '关闭'; @@ -312,6 +313,7 @@ $lang->testcase->xmindSettingTip = '特征字符设置后,Xmind主题可与 $lang->testcase->settingModule = '模块'; $lang->testcase->settingScene = '场景'; $lang->testcase->settingCase = '测试用例'; +$lang->testcase->settingPre = '前置条件'; $lang->testcase->settingPri = '优先级'; $lang->testcase->settingGroup = '步骤分组'; diff --git a/module/testcase/model.php b/module/testcase/model.php index 5ff4b1ad65..714383929d 100755 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -2342,7 +2342,7 @@ class testcaseModel extends model */ function getCaseListForXmindExport(int $productID, int $moduleID): array { - $fields = 't1.id AS testcaseID, t1.title AS `name`, t1.pri, t2.id AS productID, t2.`name` AS productName, t3.id AS moduleID, t3.`name` AS moduleName, t4.id AS sceneID, t4.title AS sceneName'; + $fields = 't1.id AS testcaseID, t1.title AS `name`, t1.pri, t2.id AS productID, t2.`name` AS productName, t3.id AS moduleID, t3.`name` AS moduleName, t4.id AS sceneID, t4.title AS sceneName, t1.precondition'; return $this->dao->select($fields)->from(TABLE_CASE)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->leftJoin(TABLE_MODULE)->alias('t3')->on('t1.module = t3.id') @@ -2485,22 +2485,23 @@ class testcaseModel extends model * @access public * @return array */ - function getXmindConfig(): array + function getMindConfig(string $type): array { $configItems = $this->dao->select("`key`,value")->from(TABLE_CONFIG) ->where('owner')->eq($this->app->user->account) ->andWhere('module')->eq('testcase') - ->andWhere('section')->eq('xmind') + ->andWhere('section')->eq($type) ->fetchAll(); $config = array(); foreach($configItems as $item) $config[$item->key] = $item->value; - if(!isset($config['module'])) $config['module'] = 'M'; - if(!isset($config['scene'])) $config['scene'] = 'S'; - if(!isset($config['case'])) $config['case'] = 'C'; - if(!isset($config['pri'])) $config['pri'] = 'P'; - if(!isset($config['group'])) $config['group'] = 'G'; + if(!isset($config['module'])) $config['module'] = 'M'; + if(!isset($config['scene'])) $config['scene'] = 'S'; + if(!isset($config['case'])) $config['case'] = 'C'; + if(!isset($config['precondition'])) $config['precondition'] = 'pre'; + if(!isset($config['pri'])) $config['pri'] = 'P'; + if(!isset($config['group'])) $config['group'] = 'G'; return $config; } @@ -2834,7 +2835,7 @@ class testcaseModel extends model $this->config->testcase->search['params']['scene']['values'] = $this->getSceneMenu($productID, $moduleID, $branch, 0, 0, true); $this->config->testcase->search['params']['lib']['values'] = $this->loadModel('caselib')->getLibraries(); - $product = $this->loadModel('product')->getByID($productID ? $productID : key($products)); + $product = $this->loadModel('product')->getByID($productID ? $productID : (int)key($products)); if((isset($product->type) && $product->type == 'normal') || $this->app->tab == 'project') { unset($this->config->testcase->search['fields']['branch']); diff --git a/module/testcase/test/lib/testcase.unittest.class.php b/module/testcase/test/lib/testcase.unittest.class.php index e10817bbf8..fff2c32f4d 100755 --- a/module/testcase/test/lib/testcase.unittest.class.php +++ b/module/testcase/test/lib/testcase.unittest.class.php @@ -1475,23 +1475,24 @@ class testcaseTest } /** - * 测试获取获取 xmind 配置。 - * Test get xmind config. + * 测试获取获取 mind 配置。 + * Test get mind config. * + * @param string $type * @param array $xmindConfig * @access public * @return array */ - public function getXmindConfigTest(array $xmindConfig): array + public function getMindConfigTest(string $type, array $xmindConfig): array { global $tester; - $tester->dao->delete()->from(TABLE_CONFIG)->where('section')->eq('xmind')->andWhere('module')->eq('testcase')->andWhere('owner')->eq($tester->app->user->account)->exec(); + $tester->dao->delete()->from(TABLE_CONFIG)->where('section')->eq($type)->andWhere('module')->eq('testcase')->andWhere('owner')->eq($tester->app->user->account)->exec(); foreach($xmindConfig as $key => $value) { $data = new stdclass(); $data->owner = $tester->app->user->account; - $data->section = 'xmind'; + $data->section = $type; $data->module = 'testcase'; $data->key = $key; $data->value = $value; @@ -1499,7 +1500,7 @@ class testcaseTest $tester->dao->insert(TABLE_CONFIG)->data($data)->exec(); } - $return = $this->objectModel->getXmindConfig(); + $return = $this->objectModel->getMindConfig($type); if(dao::isError()) return dao::getError(); return $return; } diff --git a/module/testcase/test/model/getmindconfig.php b/module/testcase/test/model/getmindconfig.php new file mode 100644 index 0000000000..9da49ca291 --- /dev/null +++ b/module/testcase/test/model/getmindconfig.php @@ -0,0 +1,51 @@ +#!/usr/bin/env php +gen('1'); + +su('admin'); + +/** + +title=测试 testcaseModel->getMindConfig(); +cid=1 +pid=1 + +*/ + +$module = array('module' => 'MM'); +$scene = array('scene' => 'SS'); +$case = array('case' => 'CC'); +$pri = array('pri' => 'PP'); +$group = array('group' => 'GG'); + +$config1 = array_merge($module, $scene, $case, $pri, $group); +$config2 = array_merge($scene, $case, $pri, $group); +$config3 = array_merge($module, $case, $pri, $group); +$config4 = array_merge($module, $scene, $pri, $group); +$config5 = array_merge($module, $scene, $case, $group); +$config6 = array_merge($module, $scene, $case, $pri); +$config7 = array_merge($module); +$config8 = array_merge($scene); +$config9 = array_merge($case); +$config10 = array_merge($pri); +$config11 = array_merge($group); +$config12 = array(); + +$type = array('xmind', 'freemind'); + +$testcase = new testcaseTest(); + +r($testcase->getMindConfigTest($type[0], $config1)) && p('module,scene,case,pri,group') && e('MM,SS,CC,PP,GG'); // 测试获取设置了 module scene case pri group 的配置 +r($testcase->getMindConfigTest($type[0], $config2)) && p('module,scene,case,pri,group') && e('M,SS,CC,PP,GG'); // 测试获取设置了 scene case pri group 的配置 +r($testcase->getMindConfigTest($type[0], $config3)) && p('module,scene,case,pri,group') && e('MM,S,CC,PP,GG'); // 测试获取设置了 module case pri group 的配置 +r($testcase->getMindConfigTest($type[0], $config4)) && p('module,scene,case,pri,group') && e('MM,SS,C,PP,GG'); // 测试获取设置了 module scene pri group 的配置 +r($testcase->getMindConfigTest($type[0], $config5)) && p('module,scene,case,pri,group') && e('MM,SS,CC,P,GG'); // 测试获取设置了 module scene case group 的配置 +r($testcase->getMindConfigTest($type[0], $config6)) && p('module,scene,case,pri,group') && e('MM,SS,CC,PP,G'); // 测试获取设置了 module scene case pri 的配置 +r($testcase->getMindConfigTest($type[1], $config7)) && p('module,scene,case,pri,group') && e('MM,S,C,P,G'); // 测试获取设置了 module 的配置 +r($testcase->getMindConfigTest($type[1], $config8)) && p('module,scene,case,pri,group') && e('M,SS,C,P,G'); // 测试获取设置了 scene 的配置 +r($testcase->getMindConfigTest($type[1], $config9)) && p('module,scene,case,pri,group') && e('M,S,CC,P,G'); // 测试获取设置了 case 的配置 +r($testcase->getMindConfigTest($type[1], $config10)) && p('module,scene,case,pri,group') && e('M,S,C,PP,G'); // 测试获取设置了 pri 的配置 +r($testcase->getMindConfigTest($type[1], $config11)) && p('module,scene,case,pri,group') && e('M,S,C,P,GG'); // 测试获取设置了 group 的配置 diff --git a/module/testcase/test/model/getxmindconfig.php b/module/testcase/test/model/getxmindconfig.php deleted file mode 100644 index 6044557210..0000000000 --- a/module/testcase/test/model/getxmindconfig.php +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env php -gen('1'); - -su('admin'); - -/** - -title=测试 testcaseModel->getXmindConfig(); -cid=1 -pid=1 - -*/ - -$module = array('module' => 'MM'); -$scene = array('scene' => 'SS'); -$case = array('case' => 'CC'); -$pri = array('pri' => 'PP'); -$group = array('group' => 'GG'); - -$config1 = array_merge($module, $scene, $case, $pri, $group); -$config2 = array_merge($scene, $case, $pri, $group); -$config3 = array_merge($module, $case, $pri, $group); -$config4 = array_merge($module, $scene, $pri, $group); -$config5 = array_merge($module, $scene, $case, $group); -$config6 = array_merge($module, $scene, $case, $pri); -$config7 = array_merge($module); -$config8 = array_merge($scene); -$config9 = array_merge($case); -$config10 = array_merge($pri); -$config11 = array_merge($group); -$config12 = array(); - -$testcase = new testcaseTest(); - -r($testcase->getXmindConfigTest($config1)) && p('module,scene,case,pri,group') && e('MM,SS,CC,PP,GG'); // 测试获取设置了 module scene case pri group 的配置 -r($testcase->getXmindConfigTest($config2)) && p('module,scene,case,pri,group') && e('M,SS,CC,PP,GG'); // 测试获取设置了 scene case pri group 的配置 -r($testcase->getXmindConfigTest($config3)) && p('module,scene,case,pri,group') && e('MM,S,CC,PP,GG'); // 测试获取设置了 module case pri group 的配置 -r($testcase->getXmindConfigTest($config4)) && p('module,scene,case,pri,group') && e('MM,SS,C,PP,GG'); // 测试获取设置了 module scene pri group 的配置 -r($testcase->getXmindConfigTest($config5)) && p('module,scene,case,pri,group') && e('MM,SS,CC,P,GG'); // 测试获取设置了 module scene case group 的配置 -r($testcase->getXmindConfigTest($config6)) && p('module,scene,case,pri,group') && e('MM,SS,CC,PP,G'); // 测试获取设置了 module scene case pri 的配置 -r($testcase->getXmindConfigTest($config7)) && p('module,scene,case,pri,group') && e('MM,S,C,P,G'); // 测试获取设置了 module 的配置 -r($testcase->getXmindConfigTest($config8)) && p('module,scene,case,pri,group') && e('M,SS,C,P,G'); // 测试获取设置了 scene 的配置 -r($testcase->getXmindConfigTest($config9)) && p('module,scene,case,pri,group') && e('M,S,CC,P,G'); // 测试获取设置了 case 的配置 -r($testcase->getXmindConfigTest($config10)) && p('module,scene,case,pri,group') && e('M,S,C,PP,G'); // 测试获取设置了 pri 的配置 -r($testcase->getXmindConfigTest($config11)) && p('module,scene,case,pri,group') && e('M,S,C,P,GG'); // 测试获取设置了 group 的配置 diff --git a/module/testcase/ui/header.html.php b/module/testcase/ui/header.html.php index 3229501c6f..3322ef1bed 100644 --- a/module/testcase/ui/header.html.php +++ b/module/testcase/ui/header.html.php @@ -40,6 +40,7 @@ $canBrowseGroupCase = hasPriv('testcase', 'groupcase'); $canAutomation = !$isExecutionApp && $canModify && hasPriv('testcase', 'automation') && !empty($productID) && $rawMethod != 'browseunits'; $canExport = !$isExecutionApp && hasPriv('testcase', 'export'); $canExportTemplate = !$isExecutionApp && hasPriv('testcase', 'exportTemplate'); +$canExportFreeMind = !$isExecutionApp && hasPriv('testcase', 'exportFreeMind'); $canExportXmind = !$isExecutionApp && hasPriv('testcase', 'exportXmind'); $canImport = !$isExecutionApp && $canModify && hasPriv('testcase', 'import'); $canImportFromLib = !$isExecutionApp && $canModify && hasPriv('testcase', 'importFromLib'); @@ -210,6 +211,12 @@ if(!empty($productID)) $exportItems[] = array('text' => $lang->testcase->xmindExport, 'url' => $link, 'data-toggle' => 'modal', 'data-app' => $app->tab); } + if($canExportFreeMind) + { + $link = $this->createLink('testcase', 'exportFreeMind', "productID=$productID&moduleID=$moduleID&branch=$branch"); + $exportItems[] = array('text' => $lang->testcase->exportFreeMind, 'url' => $link, 'data-toggle' => 'modal', 'data-app' => $app->tab); + } + if($canModify) { if($canImport) diff --git a/module/testcase/zen.php b/module/testcase/zen.php index 39aeaa23d1..cb82b44f10 100755 --- a/module/testcase/zen.php +++ b/module/testcase/zen.php @@ -2002,13 +2002,13 @@ class testcaseZen extends testcase } /** - * 检查 xmind 配置。 - * Build xmind config. + * 检查 mind 配置。 + * Build mind config. * * @access protected * @return array|bool */ - protected function buildXmindConfig(): array|bool + protected function buildMindConfig(string $type): array|bool { $configList = array(); @@ -2021,6 +2021,9 @@ class testcaseZen extends testcase $case = $this->post->case; if(!empty($case)) $configList[] = array('key' => 'case', 'value' => $case); + $precondition = $this->post->precondition; + if(!empty($precondition)) $configList[] = array('key' => 'precondition', 'value' => $precondition); + $pri = $this->post->pri; if(!empty($pri)) $configList[] = array('key' => 'pri', 'value' => $pri); @@ -2032,17 +2035,18 @@ class testcaseZen extends testcase { $key = $config['key']; $value = $config['value']; - if(!preg_match("/^[a-zA-Z]{1,10}$/", $value)) $configErrors[$key][] = sprintf($this->lang->testcase->errorXmindConfig, $this->lang->testcase->{$key}); + if(!preg_match("/^[a-zA-Z]{1,10}$/", $value)) $configErrors[$key][] = sprintf($this->lang->testcase->errorMindConfig, $this->lang->testcase->{$key}); } if(!empty($configErrors)) dao::$errors = $configErrors; $map = array(); - $map[strtolower($module)] = true; - $map[strtolower($scene)] = true; - $map[strtolower($case)] = true; - $map[strtolower($pri)] = true; - $map[strtolower($group)] = true; + $map[strtolower($module)] = true; + $map[strtolower($scene)] = true; + $map[strtolower($case)] = true; + $map[strtolower($precondition)] = true; + $map[strtolower($pri)] = true; + $map[strtolower($group)] = true; if(count($map) < 5 && count($map) > 0) dao::$errors['message'][] = '特征字符串不能重复'; return !dao::isError() ? $configList : false; @@ -2614,7 +2618,7 @@ class testcaseZen extends testcase } /** - * 获取 xmind 导出的数据。 + * 获取 mind 导出的数据。 * Get export data. * * @param int $productID @@ -2623,13 +2627,13 @@ class testcaseZen extends testcase * @access protected * @return array */ - protected function getXmindExport(int $productID, int $moduleID, string $branch): array + protected function getMindExport(string $type, int $productID, int $moduleID, string $branch): array { $caseList = $this->testcase->getCaseListForXmindExport($productID, $moduleID); $stepList = $this->testcase->getStepByProductAndModule($productID, $moduleID); $moduleList = $this->getModuleListForXmindExport($productID, $moduleID, $branch); $sceneInfo = $this->testcase->getSceneByProductAndModule($productID, $moduleID); - $config = $this->testcase->getXmindConfig(); + $config = $this->testcase->getMindConfig($type); return array('caseList' => $caseList, 'stepList' => $stepList, 'sceneMaps' => $sceneInfo['sceneMaps'], 'topScenes' => $sceneInfo['topScenes'], 'moduleList' => $moduleList, 'config' => $config); }