* [task#134149,doing,2h] add testcase::exportFreeMind,

This commit is contained in:
liumengyi
2024-12-30 09:51:11 +08:00
committed by 刘刚
parent 659b7b5835
commit dc3b20e2a4
13 changed files with 116 additions and 89 deletions
@@ -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;
}
@@ -0,0 +1,51 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/testcase.unittest.class.php';
zenData('user')->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 的配置
@@ -1,49 +0,0 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/testcase.unittest.class.php';
zenData('user')->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 的配置