* [misc] Fix code error: change \$this to $this.
This commit is contained in:
@@ -251,77 +251,77 @@ class cneModelTest extends baseTest
|
||||
global $config;
|
||||
|
||||
// 确保CNE配置结构存在
|
||||
if(!isset(\$this->instance->configCNE)) \$this->instance->configCNE = new stdclass();
|
||||
if(!isset(\$this->instance->configCNE->app)) \$this->instance->configCNE->app = new stdclass();
|
||||
if(!isset(\$this->instance->configCNE->app->domain)) \$this->instance->configCNE->app->domain = '';
|
||||
if(!isset($this->instance->configCNE)) $this->instance->configCNE = new stdclass();
|
||||
if(!isset($this->instance->configCNE->app)) $this->instance->configCNE->app = new stdclass();
|
||||
if(!isset($this->instance->configCNE->app->domain)) $this->instance->configCNE->app->domain = '';
|
||||
|
||||
// 保存原始配置
|
||||
$originalAppDomain = \$this->instance->configCNE->app->domain;
|
||||
$originalAppDomain = $this->instance->configCNE->app->domain;
|
||||
$originalEnvDomain = getenv('APP_DOMAIN');
|
||||
|
||||
switch($scenario) {
|
||||
case 'empty_all':
|
||||
// 测试所有域名配置都为空的情况
|
||||
\$this->instance->configCNE->app->domain = '';
|
||||
$this->instance->configCNE->app->domain = '';
|
||||
putenv('APP_DOMAIN=');
|
||||
// 模拟数据库中也没有配置
|
||||
return '';
|
||||
|
||||
case 'config_only':
|
||||
// 测试只有配置中有域名的情况
|
||||
\$this->instance->configCNE->app->domain = 'config.test.com';
|
||||
$this->instance->configCNE->app->domain = 'config.test.com';
|
||||
putenv('APP_DOMAIN=');
|
||||
return \$this->instance->configCNE->app->domain;
|
||||
return $this->instance->configCNE->app->domain;
|
||||
|
||||
case 'env_only':
|
||||
// 测试只有环境变量中有域名的情况
|
||||
\$this->instance->configCNE->app->domain = '';
|
||||
$this->instance->configCNE->app->domain = '';
|
||||
putenv('APP_DOMAIN=env.test.com');
|
||||
return getenv('APP_DOMAIN');
|
||||
|
||||
case 'db_only':
|
||||
// 测试只有数据库中有域名的情况
|
||||
\$this->instance->configCNE->app->domain = '';
|
||||
$this->instance->configCNE->app->domain = '';
|
||||
putenv('APP_DOMAIN=');
|
||||
// 模拟数据库配置
|
||||
return 'db.test.com';
|
||||
|
||||
case 'priority_test':
|
||||
// 测试优先级:数据库 > 环境变量 > 配置文件
|
||||
\$this->instance->configCNE->app->domain = 'config.test.com';
|
||||
$this->instance->configCNE->app->domain = 'config.test.com';
|
||||
putenv('APP_DOMAIN=env.test.com');
|
||||
// 数据库配置优先级最高
|
||||
return 'db.test.com';
|
||||
|
||||
case 'env_over_config':
|
||||
// 测试环境变量优先于配置文件
|
||||
\$this->instance->configCNE->app->domain = 'config.test.com';
|
||||
$this->instance->configCNE->app->domain = 'config.test.com';
|
||||
putenv('APP_DOMAIN=env.test.com');
|
||||
// 无数据库配置时,环境变量优先
|
||||
return getenv('APP_DOMAIN');
|
||||
|
||||
case 'special_chars':
|
||||
// 测试包含特殊字符的域名
|
||||
\$this->instance->configCNE->app->domain = '';
|
||||
$this->instance->configCNE->app->domain = '';
|
||||
putenv('APP_DOMAIN=sub-domain.test-env.com');
|
||||
return getenv('APP_DOMAIN');
|
||||
|
||||
case 'unicode_domain':
|
||||
// 测试Unicode域名
|
||||
\$this->instance->configCNE->app->domain = '';
|
||||
$this->instance->configCNE->app->domain = '';
|
||||
putenv('APP_DOMAIN=测试.example.com');
|
||||
return getenv('APP_DOMAIN');
|
||||
|
||||
case 'numeric_domain':
|
||||
// 测试数字域名
|
||||
\$this->instance->configCNE->app->domain = '';
|
||||
$this->instance->configCNE->app->domain = '';
|
||||
putenv('APP_DOMAIN=123.456.789.com');
|
||||
return getenv('APP_DOMAIN');
|
||||
|
||||
case 'long_domain':
|
||||
// 测试长域名
|
||||
$longDomain = str_repeat('a', 50) . '.example.com';
|
||||
\$this->instance->configCNE->app->domain = '';
|
||||
$this->instance->configCNE->app->domain = '';
|
||||
putenv('APP_DOMAIN=' . $longDomain);
|
||||
return getenv('APP_DOMAIN');
|
||||
|
||||
@@ -335,7 +335,7 @@ class cneModelTest extends baseTest
|
||||
return '';
|
||||
} finally {
|
||||
// 恢复原始配置
|
||||
\$this->instance->configCNE->app->domain = $originalAppDomain;
|
||||
$this->instance->configCNE->app->domain = $originalAppDomain;
|
||||
if($originalEnvDomain !== false) {
|
||||
putenv('APP_DOMAIN=' . $originalEnvDomain);
|
||||
} else {
|
||||
|
||||
@@ -344,8 +344,8 @@ class commonModelTest extends baseTest
|
||||
global $app, $config;
|
||||
|
||||
// 备份原始配置和状态
|
||||
$originalInContainer = isset(\$this->instance->configinContainer) ? \$this->instance->configinContainer : false;
|
||||
$originalModuleName = method_exists($app, 'getModuleName') ? \$this->instance->appgetModuleName() : 'common';
|
||||
$originalInContainer = isset($this->instance->configinContainer) ? $this->instance->configinContainer : false;
|
||||
$originalModuleName = method_exists($app, 'getModuleName') ? $this->instance->appgetModuleName() : 'common';
|
||||
$originalUpgrading = isset($_SESSION['upgrading']) ? $_SESSION['upgrading'] : false;
|
||||
$originalSafeFileEnv = getenv('ZT_CHECK_SAFE_FILE');
|
||||
|
||||
@@ -353,26 +353,26 @@ class commonModelTest extends baseTest
|
||||
// 根据场景设置不同的测试环境
|
||||
switch($scenario) {
|
||||
case 'inContainer':
|
||||
\$this->instance->configinContainer = true;
|
||||
$this->instance->configinContainer = true;
|
||||
break;
|
||||
|
||||
case 'validSafeFile':
|
||||
\$this->instance->configinContainer = false;
|
||||
$this->instance->configinContainer = false;
|
||||
// 设置环境变量模拟有效的安全文件状态
|
||||
putenv('ZT_CHECK_SAFE_FILE=true');
|
||||
break;
|
||||
|
||||
case 'upgradeModule':
|
||||
\$this->instance->configinContainer = false;
|
||||
$this->instance->configinContainer = false;
|
||||
if(isset($_SESSION)) $_SESSION['upgrading'] = true;
|
||||
// 设置为upgrade模块
|
||||
if(method_exists($app, 'setModuleName')) \$this->instance->appsetModuleName('upgrade');
|
||||
if(method_exists($app, 'setModuleName')) $this->instance->appsetModuleName('upgrade');
|
||||
break;
|
||||
|
||||
case 'noSafeFile':
|
||||
case 'expiredSafeFile':
|
||||
default:
|
||||
\$this->instance->configinContainer = false;
|
||||
$this->instance->configinContainer = false;
|
||||
// 确保没有有效的安全文件
|
||||
putenv('ZT_CHECK_SAFE_FILE=false');
|
||||
if(isset($_SESSION)) $_SESSION['upgrading'] = false;
|
||||
@@ -385,9 +385,9 @@ class commonModelTest extends baseTest
|
||||
return $result;
|
||||
} finally {
|
||||
// 恢复原始配置和状态
|
||||
\$this->instance->configinContainer = $originalInContainer;
|
||||
$this->instance->configinContainer = $originalInContainer;
|
||||
if(isset($_SESSION)) $_SESSION['upgrading'] = $originalUpgrading;
|
||||
if(method_exists($app, 'setModuleName')) \$this->instance->appsetModuleName($originalModuleName);
|
||||
if(method_exists($app, 'setModuleName')) $this->instance->appsetModuleName($originalModuleName);
|
||||
if($originalSafeFileEnv !== false) {
|
||||
putenv("ZT_CHECK_SAFE_FILE=$originalSafeFileEnv");
|
||||
} else {
|
||||
|
||||
@@ -208,16 +208,16 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraApi = \$this->instance->appsession->jiraApi ?? null;
|
||||
$originalJiraApi = $this->instance->appsession->jiraApi ?? null;
|
||||
|
||||
// 检查是否有session数据,如果没有则设置默认测试数据
|
||||
if(empty(\$this->instance->appsession->jiraApi)) {
|
||||
if(empty($this->instance->appsession->jiraApi)) {
|
||||
$testJiraApi = array(
|
||||
'domain' => 'https://test.atlassian.net',
|
||||
'admin' => 'testuser',
|
||||
'token' => 'testtoken123'
|
||||
);
|
||||
\$this->instance->appsession->set('jiraApi', json_encode($testJiraApi));
|
||||
$this->instance->appsession->set('jiraApi', json_encode($testJiraApi));
|
||||
}
|
||||
|
||||
$result = $this->instance->callJiraAPI($url, $start);
|
||||
@@ -225,26 +225,26 @@ class convertModelTest extends baseTest
|
||||
|
||||
// 恢复原始session数据
|
||||
if($originalJiraApi !== null) {
|
||||
\$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraApi');
|
||||
$this->instance->appsession->destroy('jiraApi');
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraApi) && $originalJiraApi !== null) {
|
||||
\$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraApi');
|
||||
$this->instance->appsession->destroy('jiraApi');
|
||||
}
|
||||
return 'exception: ' . $e->getMessage();
|
||||
} catch (Error $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraApi) && $originalJiraApi !== null) {
|
||||
\$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraApi');
|
||||
$this->instance->appsession->destroy('jiraApi');
|
||||
}
|
||||
return 'error: ' . $e->getMessage();
|
||||
}
|
||||
@@ -312,14 +312,14 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraApi = \$this->instance->appsession->jiraApi ?? null;
|
||||
$originalJiraApi = $this->instance->appsession->jiraApi ?? null;
|
||||
|
||||
// 设置测试session数据
|
||||
if(!empty($jiraApiData)) {
|
||||
\$this->instance->appsession->set('jiraApi', json_encode($jiraApiData));
|
||||
$this->instance->appsession->set('jiraApi', json_encode($jiraApiData));
|
||||
} else {
|
||||
// 清空jiraApi session数据
|
||||
\$this->instance->appsession->set('jiraApi', '');
|
||||
$this->instance->appsession->set('jiraApi', '');
|
||||
}
|
||||
|
||||
$result = $this->instance->checkJiraApi();
|
||||
@@ -329,26 +329,26 @@ class convertModelTest extends baseTest
|
||||
|
||||
// 恢复原始session数据
|
||||
if($originalJiraApi !== null) {
|
||||
\$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraApi');
|
||||
$this->instance->appsession->destroy('jiraApi');
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraApi) && $originalJiraApi !== null) {
|
||||
\$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraApi');
|
||||
$this->instance->appsession->destroy('jiraApi');
|
||||
}
|
||||
return 'exception: ' . $e->getMessage();
|
||||
} catch (Error $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraApi) && $originalJiraApi !== null) {
|
||||
\$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
$this->instance->appsession->set('jiraApi', $originalJiraApi);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraApi');
|
||||
$this->instance->appsession->destroy('jiraApi');
|
||||
}
|
||||
return 'error: ' . $e->getMessage();
|
||||
}
|
||||
@@ -368,7 +368,7 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraRelation = \$this->instance->appsession->jiraRelation ?? null;
|
||||
$originalJiraRelation = $this->instance->appsession->jiraRelation ?? null;
|
||||
|
||||
// 如果没有提供relations参数,设置测试session数据
|
||||
if(empty($relations)) {
|
||||
@@ -385,7 +385,7 @@ class convertModelTest extends baseTest
|
||||
'done' => 'developed'
|
||||
)
|
||||
);
|
||||
\$this->instance->appsession->set('jiraRelation', json_encode($testRelations));
|
||||
$this->instance->appsession->set('jiraRelation', json_encode($testRelations));
|
||||
}
|
||||
|
||||
$result = $this->instance->convertStage($jiraStatus, $issueType, $relations);
|
||||
@@ -393,26 +393,26 @@ class convertModelTest extends baseTest
|
||||
|
||||
// 恢复原始session数据
|
||||
if($originalJiraRelation !== null) {
|
||||
\$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraRelation');
|
||||
$this->instance->appsession->destroy('jiraRelation');
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraRelation) && $originalJiraRelation !== null) {
|
||||
\$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraRelation');
|
||||
$this->instance->appsession->destroy('jiraRelation');
|
||||
}
|
||||
return 'exception: ' . $e->getMessage();
|
||||
} catch (Error $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraRelation) && $originalJiraRelation !== null) {
|
||||
\$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraRelation');
|
||||
$this->instance->appsession->destroy('jiraRelation');
|
||||
}
|
||||
return 'error: ' . $e->getMessage();
|
||||
}
|
||||
@@ -433,10 +433,10 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据和配置
|
||||
global $app, $config;
|
||||
$originalJiraRelation = \$this->instance->appsession->jiraRelation ?? null;
|
||||
$originalTestcaseNeedReview = \$this->instance->configtestcase->needReview ?? null;
|
||||
$originalFeedbackNeedReview = \$this->instance->configfeedback->needReview ?? null;
|
||||
$originalFeedbackTicket = \$this->instance->configfeedback->ticket ?? null;
|
||||
$originalJiraRelation = $this->instance->appsession->jiraRelation ?? null;
|
||||
$originalTestcaseNeedReview = $this->instance->configtestcase->needReview ?? null;
|
||||
$originalFeedbackNeedReview = $this->instance->configfeedback->needReview ?? null;
|
||||
$originalFeedbackTicket = $this->instance->configfeedback->ticket ?? null;
|
||||
|
||||
// 如果没有提供relations参数,设置测试session数据
|
||||
if(empty($relations)) {
|
||||
@@ -453,7 +453,7 @@ class convertModelTest extends baseTest
|
||||
'done' => 'done'
|
||||
)
|
||||
);
|
||||
\$this->instance->appsession->set('jiraRelation', json_encode($testRelations));
|
||||
$this->instance->appsession->set('jiraRelation', json_encode($testRelations));
|
||||
}
|
||||
|
||||
$result = $this->instance->convertStatus($objectType, $jiraStatus, $issueType, $relations);
|
||||
@@ -461,57 +461,57 @@ class convertModelTest extends baseTest
|
||||
|
||||
// 恢复原始session数据和配置
|
||||
if($originalJiraRelation !== null) {
|
||||
\$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraRelation');
|
||||
$this->instance->appsession->destroy('jiraRelation');
|
||||
}
|
||||
|
||||
if($originalTestcaseNeedReview !== null) {
|
||||
\$this->instance->configtestcase->needReview = $originalTestcaseNeedReview;
|
||||
$this->instance->configtestcase->needReview = $originalTestcaseNeedReview;
|
||||
}
|
||||
if($originalFeedbackNeedReview !== null) {
|
||||
\$this->instance->configfeedback->needReview = $originalFeedbackNeedReview;
|
||||
$this->instance->configfeedback->needReview = $originalFeedbackNeedReview;
|
||||
}
|
||||
if($originalFeedbackTicket !== null) {
|
||||
\$this->instance->configfeedback->ticket = $originalFeedbackTicket;
|
||||
$this->instance->configfeedback->ticket = $originalFeedbackTicket;
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
// 恢复原始session数据和配置
|
||||
if(isset($originalJiraRelation) && $originalJiraRelation !== null) {
|
||||
\$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraRelation');
|
||||
$this->instance->appsession->destroy('jiraRelation');
|
||||
}
|
||||
|
||||
if(isset($originalTestcaseNeedReview) && $originalTestcaseNeedReview !== null) {
|
||||
\$this->instance->configtestcase->needReview = $originalTestcaseNeedReview;
|
||||
$this->instance->configtestcase->needReview = $originalTestcaseNeedReview;
|
||||
}
|
||||
if(isset($originalFeedbackNeedReview) && $originalFeedbackNeedReview !== null) {
|
||||
\$this->instance->configfeedback->needReview = $originalFeedbackNeedReview;
|
||||
$this->instance->configfeedback->needReview = $originalFeedbackNeedReview;
|
||||
}
|
||||
if(isset($originalFeedbackTicket) && $originalFeedbackTicket !== null) {
|
||||
\$this->instance->configfeedback->ticket = $originalFeedbackTicket;
|
||||
$this->instance->configfeedback->ticket = $originalFeedbackTicket;
|
||||
}
|
||||
|
||||
return 'exception: ' . $e->getMessage();
|
||||
} catch (Error $e) {
|
||||
// 恢复原始session数据和配置
|
||||
if(isset($originalJiraRelation) && $originalJiraRelation !== null) {
|
||||
\$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraRelation');
|
||||
$this->instance->appsession->destroy('jiraRelation');
|
||||
}
|
||||
|
||||
if(isset($originalTestcaseNeedReview) && $originalTestcaseNeedReview !== null) {
|
||||
\$this->instance->configtestcase->needReview = $originalTestcaseNeedReview;
|
||||
$this->instance->configtestcase->needReview = $originalTestcaseNeedReview;
|
||||
}
|
||||
if(isset($originalFeedbackNeedReview) && $originalFeedbackNeedReview !== null) {
|
||||
\$this->instance->configfeedback->needReview = $originalFeedbackNeedReview;
|
||||
$this->instance->configfeedback->needReview = $originalFeedbackNeedReview;
|
||||
}
|
||||
if(isset($originalFeedbackTicket) && $originalFeedbackTicket !== null) {
|
||||
\$this->instance->configfeedback->ticket = $originalFeedbackTicket;
|
||||
$this->instance->configfeedback->ticket = $originalFeedbackTicket;
|
||||
}
|
||||
|
||||
return 'error: ' . $e->getMessage();
|
||||
@@ -558,7 +558,7 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 获取jirafile目录路径
|
||||
global $app;
|
||||
$jiraPath = \$this->instance->appgetTmpRoot() . 'jirafile/';
|
||||
$jiraPath = $this->instance->appgetTmpRoot() . 'jirafile/';
|
||||
|
||||
// 创建测试目录和测试文件
|
||||
if(!is_dir($jiraPath)) mkdir($jiraPath, 0777, true);
|
||||
@@ -602,14 +602,14 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraMethod = \$this->instance->appsession->jiraMethod ?? null;
|
||||
$originalJiraMethod = $this->instance->appsession->jiraMethod ?? null;
|
||||
|
||||
// 设置测试session数据
|
||||
\$this->instance->appsession->set('jiraMethod', 'db');
|
||||
$this->instance->appsession->set('jiraMethod', 'db');
|
||||
|
||||
// 模拟sourceDBH连接
|
||||
if(empty($this->instance->sourceDBH)) {
|
||||
$this->instance->sourceDBH = \$this->instance->appdbh;
|
||||
$this->instance->sourceDBH = $this->instance->appdbh;
|
||||
}
|
||||
|
||||
$result = $this->instance->getIssueTypeList($relations);
|
||||
@@ -646,12 +646,12 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraMethod = \$this->instance->appsession->jiraMethod ?? null;
|
||||
$originalJiraUser = \$this->instance->appsession->jiraUser ?? null;
|
||||
$originalJiraMethod = $this->instance->appsession->jiraMethod ?? null;
|
||||
$originalJiraUser = $this->instance->appsession->jiraUser ?? null;
|
||||
|
||||
// 设置测试session数据
|
||||
\$this->instance->appsession->set('jiraMethod', 'test');
|
||||
\$this->instance->appsession->set('jiraUser', array('mode' => 'account'));
|
||||
$this->instance->appsession->set('jiraMethod', 'test');
|
||||
$this->instance->appsession->set('jiraUser', array('mode' => 'account'));
|
||||
|
||||
// 创建模拟的getJiraData方法
|
||||
$originalGetJiraData = null;
|
||||
@@ -666,7 +666,7 @@ class convertModelTest extends baseTest
|
||||
// 使用反射来模拟getJiraData方法的返回值
|
||||
$mockModel = $this->createMockConvertModel();
|
||||
$mockModel->mockUsers = $mockUsers;
|
||||
$mockModel->session = \$this->instance->appsession;
|
||||
$mockModel->session = $this->instance->appsession;
|
||||
|
||||
$result = $mockModel->getJiraAccount($userKey);
|
||||
} else {
|
||||
@@ -675,42 +675,42 @@ class convertModelTest extends baseTest
|
||||
|
||||
// 恢复原始session数据
|
||||
if($originalJiraMethod !== null) {
|
||||
\$this->instance->appsession->set('jiraMethod', $originalJiraMethod);
|
||||
$this->instance->appsession->set('jiraMethod', $originalJiraMethod);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraMethod');
|
||||
$this->instance->appsession->destroy('jiraMethod');
|
||||
}
|
||||
|
||||
if($originalJiraUser !== null) {
|
||||
\$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraUser');
|
||||
$this->instance->appsession->destroy('jiraUser');
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraMethod) && $originalJiraMethod !== null) {
|
||||
\$this->instance->appsession->set('jiraMethod', $originalJiraMethod);
|
||||
$this->instance->appsession->set('jiraMethod', $originalJiraMethod);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraMethod');
|
||||
$this->instance->appsession->destroy('jiraMethod');
|
||||
}
|
||||
if(isset($originalJiraUser) && $originalJiraUser !== null) {
|
||||
\$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraUser');
|
||||
$this->instance->appsession->destroy('jiraUser');
|
||||
}
|
||||
return 'exception: ' . $e->getMessage();
|
||||
} catch (Error $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraMethod) && $originalJiraMethod !== null) {
|
||||
\$this->instance->appsession->set('jiraMethod', $originalJiraMethod);
|
||||
$this->instance->appsession->set('jiraMethod', $originalJiraMethod);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraMethod');
|
||||
$this->instance->appsession->destroy('jiraMethod');
|
||||
}
|
||||
if(isset($originalJiraUser) && $originalJiraUser !== null) {
|
||||
\$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraUser');
|
||||
$this->instance->appsession->destroy('jiraUser');
|
||||
}
|
||||
return 'error: ' . $e->getMessage();
|
||||
}
|
||||
@@ -728,15 +728,15 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraMethod = \$this->instance->appsession->jiraMethod ?? null;
|
||||
$originalJiraApi = \$this->instance->appsession->jiraApi ?? null;
|
||||
$originalJiraMethod = $this->instance->appsession->jiraMethod ?? null;
|
||||
$originalJiraApi = $this->instance->appsession->jiraApi ?? null;
|
||||
|
||||
// 设置测试session数据
|
||||
\$this->instance->appsession->set('jiraMethod', 'db');
|
||||
$this->instance->appsession->set('jiraMethod', 'db');
|
||||
|
||||
// 模拟sourceDBH连接
|
||||
if(empty($this->instance->sourceDBH)) {
|
||||
$this->instance->sourceDBH = \$this->instance->appdbh;
|
||||
$this->instance->sourceDBH = $this->instance->appdbh;
|
||||
}
|
||||
|
||||
$result = $this->instance->getJiraArchivedProject($dataList);
|
||||
@@ -1036,11 +1036,11 @@ class convertModelTest extends baseTest
|
||||
{
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraRelation = \$this->instance->appsession->jiraRelation ?? null;
|
||||
$originalJiraRelation = $this->instance->appsession->jiraRelation ?? null;
|
||||
|
||||
// 设置测试session数据
|
||||
if(!empty($sessionData['jiraRelation'])) {
|
||||
\$this->instance->appsession->set('jiraRelation', $sessionData['jiraRelation']);
|
||||
$this->instance->appsession->set('jiraRelation', $sessionData['jiraRelation']);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -1049,26 +1049,26 @@ class convertModelTest extends baseTest
|
||||
$errors = dao::getError();
|
||||
// 恢复原始session数据
|
||||
if($originalJiraRelation !== null) {
|
||||
\$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraRelation');
|
||||
$this->instance->appsession->destroy('jiraRelation');
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
// 恢复原始session数据
|
||||
if($originalJiraRelation !== null) {
|
||||
\$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraRelation');
|
||||
$this->instance->appsession->destroy('jiraRelation');
|
||||
}
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
// 恢复原始session数据
|
||||
if($originalJiraRelation !== null) {
|
||||
\$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
$this->instance->appsession->set('jiraRelation', $originalJiraRelation);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraRelation');
|
||||
$this->instance->appsession->destroy('jiraRelation');
|
||||
}
|
||||
return 'exception: ' . $e->getMessage();
|
||||
}
|
||||
@@ -1112,12 +1112,12 @@ class convertModelTest extends baseTest
|
||||
public function getZentaoObjectListTestWithoutER()
|
||||
{
|
||||
global $config;
|
||||
$originalER = \$this->instance->configenableER ?? true;
|
||||
\$this->instance->configenableER = false;
|
||||
$originalER = $this->instance->configenableER ?? true;
|
||||
$this->instance->configenableER = false;
|
||||
|
||||
$result = $this->instance->getZentaoObjectList();
|
||||
|
||||
\$this->instance->configenableER = $originalER;
|
||||
$this->instance->configenableER = $originalER;
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
@@ -1204,13 +1204,13 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraUser = \$this->instance->appsession->jiraUser ?? null;
|
||||
$originalJiraUser = $this->instance->appsession->jiraUser ?? null;
|
||||
|
||||
// 设置测试用户配置
|
||||
if(!empty($userConfig)) {
|
||||
\$this->instance->appsession->set('jiraUser', $userConfig);
|
||||
$this->instance->appsession->set('jiraUser', $userConfig);
|
||||
} else {
|
||||
\$this->instance->appsession->set('jiraUser', array('mode' => 'account'));
|
||||
$this->instance->appsession->set('jiraUser', array('mode' => 'account'));
|
||||
}
|
||||
|
||||
$result = $this->instance->processJiraUser($jiraAccount, $jiraEmail);
|
||||
@@ -1218,26 +1218,26 @@ class convertModelTest extends baseTest
|
||||
|
||||
// 恢复原始session数据
|
||||
if($originalJiraUser !== null) {
|
||||
\$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraUser');
|
||||
$this->instance->appsession->destroy('jiraUser');
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraUser) && $originalJiraUser !== null) {
|
||||
\$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraUser');
|
||||
$this->instance->appsession->destroy('jiraUser');
|
||||
}
|
||||
return 'exception: ' . $e->getMessage();
|
||||
} catch (Error $e) {
|
||||
// 恢复原始session数据
|
||||
if(isset($originalJiraUser) && $originalJiraUser !== null) {
|
||||
\$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraUser');
|
||||
$this->instance->appsession->destroy('jiraUser');
|
||||
}
|
||||
return 'error: ' . $e->getMessage();
|
||||
}
|
||||
@@ -1283,7 +1283,7 @@ class convertModelTest extends baseTest
|
||||
}
|
||||
|
||||
global $app;
|
||||
\$this->instance->appsession->set('state', $state);
|
||||
$this->instance->appsession->set('state', $state);
|
||||
|
||||
return is_array($state) ? 'array' : gettype($state);
|
||||
}
|
||||
@@ -1299,7 +1299,7 @@ class convertModelTest extends baseTest
|
||||
try {
|
||||
// 检查源文件是否存在
|
||||
global $app;
|
||||
$jiraPath = \$this->instance->appgetTmpRoot() . 'jirafile/';
|
||||
$jiraPath = $this->instance->appgetTmpRoot() . 'jirafile/';
|
||||
$sourceFile = $jiraPath . 'entities.xml';
|
||||
|
||||
if(!file_exists($sourceFile))
|
||||
|
||||
@@ -1088,11 +1088,11 @@ class convertTaoTest extends baseTest
|
||||
{
|
||||
try {
|
||||
global $tester;
|
||||
$project = \$this->instance->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch();
|
||||
$project = $this->instance->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch();
|
||||
if(!$project) return 0;
|
||||
|
||||
/* Load doc language to avoid createDocLib error. */
|
||||
\$this->instance->loadModel('doc');
|
||||
$this->instance->loadModel('doc');
|
||||
|
||||
$reflection = new ReflectionClass($this->instance);
|
||||
$method = $reflection->getMethod('createDefaultExecution');
|
||||
@@ -1204,7 +1204,7 @@ class convertTaoTest extends baseTest
|
||||
public function createExecutionTest($jiraProjectID = 1001, $projectID = 1, $sprintGroup = array(), $projectRoleActor = array())
|
||||
{
|
||||
global $tester;
|
||||
$project = \$this->instance->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch();
|
||||
$project = $this->instance->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch();
|
||||
if(!$project) return 0;
|
||||
|
||||
// Simulate createExecution method behavior
|
||||
@@ -1531,7 +1531,7 @@ class convertTaoTest extends baseTest
|
||||
|
||||
// 确保数据库连接可用
|
||||
if(empty($this->instance->dbh)) {
|
||||
$this->instance->dbh = \$this->instance->dbh;
|
||||
$this->instance->dbh = $this->instance->dbh;
|
||||
}
|
||||
|
||||
// 确保常量已定义
|
||||
@@ -1571,9 +1571,9 @@ class convertTaoTest extends baseTest
|
||||
{
|
||||
// 备份和设置必要的session数据
|
||||
global $app, $config;
|
||||
$originalJiraMethod = \$this->instance->appsession->jiraMethod ?? null;
|
||||
if(empty(\$this->instance->appsession->jiraMethod)) {
|
||||
\$this->instance->appsession->jiraMethod = 'test';
|
||||
$originalJiraMethod = $this->instance->appsession->jiraMethod ?? null;
|
||||
if(empty($this->instance->appsession->jiraMethod)) {
|
||||
$this->instance->appsession->jiraMethod = 'test';
|
||||
}
|
||||
|
||||
// 确保tao对象使用当前的config
|
||||
@@ -1589,9 +1589,9 @@ class convertTaoTest extends baseTest
|
||||
|
||||
// 恢复session数据
|
||||
if($originalJiraMethod !== null) {
|
||||
\$this->instance->appsession->jiraMethod = $originalJiraMethod;
|
||||
$this->instance->appsession->jiraMethod = $originalJiraMethod;
|
||||
} else {
|
||||
unset(\$this->instance->appsession->jiraMethod);
|
||||
unset($this->instance->appsession->jiraMethod);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -1600,9 +1600,9 @@ class convertTaoTest extends baseTest
|
||||
{
|
||||
// 恢复session数据
|
||||
if(isset($originalJiraMethod) && $originalJiraMethod !== null) {
|
||||
\$this->instance->appsession->jiraMethod = $originalJiraMethod;
|
||||
} elseif(isset(\$this->instance->appsession->jiraMethod)) {
|
||||
unset(\$this->instance->appsession->jiraMethod);
|
||||
$this->instance->appsession->jiraMethod = $originalJiraMethod;
|
||||
} elseif(isset($this->instance->appsession->jiraMethod)) {
|
||||
unset($this->instance->appsession->jiraMethod);
|
||||
}
|
||||
return 'exception: ' . $e->getMessage();
|
||||
}
|
||||
@@ -1661,13 +1661,13 @@ class convertTaoTest extends baseTest
|
||||
global $config;
|
||||
|
||||
// 模拟版本配置
|
||||
$originalEdition = isset(\$this->instance->configedition) ? \$this->instance->configedition : 'open';
|
||||
\$this->instance->configedition = $edition;
|
||||
$originalEdition = isset($this->instance->configedition) ? $this->instance->configedition : 'open';
|
||||
$this->instance->configedition = $edition;
|
||||
|
||||
// 如果是开源版,直接返回原始relations
|
||||
if($edition == 'open')
|
||||
{
|
||||
\$this->instance->configedition = $originalEdition;
|
||||
$this->instance->configedition = $originalEdition;
|
||||
return serialize($relations);
|
||||
}
|
||||
|
||||
@@ -1675,7 +1675,7 @@ class convertTaoTest extends baseTest
|
||||
// 如果没有项目关系,返回原始relations
|
||||
if(empty($projectRelations))
|
||||
{
|
||||
\$this->instance->configedition = $originalEdition;
|
||||
$this->instance->configedition = $originalEdition;
|
||||
return serialize($relations);
|
||||
}
|
||||
|
||||
@@ -1690,7 +1690,7 @@ class convertTaoTest extends baseTest
|
||||
}
|
||||
|
||||
// 恢复原始配置
|
||||
\$this->instance->configedition = $originalEdition;
|
||||
$this->instance->configedition = $originalEdition;
|
||||
|
||||
return serialize($relations);
|
||||
}
|
||||
@@ -1708,7 +1708,7 @@ class convertTaoTest extends baseTest
|
||||
|
||||
// 模拟原方法的核心逻辑
|
||||
// 1. 如果是开源版本,直接返回relations
|
||||
if(isset(\$this->instance->configedition) && \$this->instance->configedition == 'open')
|
||||
if(isset($this->instance->configedition) && $this->instance->configedition == 'open')
|
||||
{
|
||||
return serialize($relations);
|
||||
}
|
||||
@@ -1891,16 +1891,16 @@ class convertTaoTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraMethod = \$this->instance->appsession->jiraMethod ?? null;
|
||||
$originalJiraMethod = $this->instance->appsession->jiraMethod ?? null;
|
||||
|
||||
// 设置测试session数据
|
||||
if(empty(\$this->instance->appsession->jiraMethod)) {
|
||||
\$this->instance->appsession->set('jiraMethod', 'file');
|
||||
if(empty($this->instance->appsession->jiraMethod)) {
|
||||
$this->instance->appsession->set('jiraMethod', 'file');
|
||||
}
|
||||
|
||||
// 设置dbh属性,确保数据库连接可用
|
||||
if(empty($this->instance->dbh)) {
|
||||
$this->instance->dbh = \$this->instance->appdbh;
|
||||
$this->instance->dbh = $this->instance->appdbh;
|
||||
}
|
||||
|
||||
// 测试不同场景
|
||||
@@ -2003,7 +2003,7 @@ class convertTaoTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraRelation = \$this->instance->appsession->jiraRelation ?? null;
|
||||
$originalJiraRelation = $this->instance->appsession->jiraRelation ?? null;
|
||||
$originalEdition = $this->instance->config->edition ?? null;
|
||||
|
||||
// 设置测试session数据
|
||||
@@ -2015,14 +2015,14 @@ class convertTaoTest extends baseTest
|
||||
'relates' => 'relates'
|
||||
)
|
||||
);
|
||||
\$this->instance->appsession->set('jiraRelation', json_encode($testRelations));
|
||||
$this->instance->appsession->set('jiraRelation', json_encode($testRelations));
|
||||
|
||||
// 设置edition为open以简化测试
|
||||
$this->instance->config->edition = 'open';
|
||||
|
||||
// 设置dbh属性,确保数据库连接可用
|
||||
if(empty($this->instance->dbh)) {
|
||||
$this->instance->dbh = \$this->instance->appdbh;
|
||||
$this->instance->dbh = $this->instance->appdbh;
|
||||
}
|
||||
|
||||
// 对于简化测试,只验证方法调用是否正常
|
||||
@@ -2081,7 +2081,7 @@ class convertTaoTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraRelation = \$this->instance->appsession->jiraRelation ?? null;
|
||||
$originalJiraRelation = $this->instance->appsession->jiraRelation ?? null;
|
||||
$originalEdition = $this->instance->config->edition ?? null;
|
||||
|
||||
// 设置测试session数据
|
||||
@@ -2093,14 +2093,14 @@ class convertTaoTest extends baseTest
|
||||
'relates' => 'relates'
|
||||
)
|
||||
);
|
||||
\$this->instance->appsession->set('jiraRelation', json_encode($testRelations));
|
||||
$this->instance->appsession->set('jiraRelation', json_encode($testRelations));
|
||||
|
||||
// 设置edition为open以简化测试
|
||||
$this->instance->config->edition = 'open';
|
||||
|
||||
// 设置dbh属性,确保数据库连接可用
|
||||
if(empty($this->instance->dbh)) {
|
||||
$this->instance->dbh = \$this->instance->appdbh;
|
||||
$this->instance->dbh = $this->instance->appdbh;
|
||||
}
|
||||
|
||||
// 对于简化测试,只验证方法调用是否正常
|
||||
@@ -2159,20 +2159,20 @@ class convertTaoTest extends baseTest
|
||||
try {
|
||||
// 备份原始session数据
|
||||
global $app;
|
||||
$originalJiraMethod = \$this->instance->appsession->jiraMethod ?? null;
|
||||
$originalJiraUser = \$this->instance->appsession->jiraUser ?? null;
|
||||
$originalJiraMethod = $this->instance->appsession->jiraMethod ?? null;
|
||||
$originalJiraUser = $this->instance->appsession->jiraUser ?? null;
|
||||
|
||||
// 设置测试session数据
|
||||
if(empty(\$this->instance->appsession->jiraMethod)) {
|
||||
\$this->instance->appsession->set('jiraMethod', 'file');
|
||||
if(empty($this->instance->appsession->jiraMethod)) {
|
||||
$this->instance->appsession->set('jiraMethod', 'file');
|
||||
}
|
||||
if(empty(\$this->instance->appsession->jiraUser)) {
|
||||
\$this->instance->appsession->set('jiraUser', json_encode(array('password' => '123456', 'group' => 1, 'mode' => 'account')));
|
||||
if(empty($this->instance->appsession->jiraUser)) {
|
||||
$this->instance->appsession->set('jiraUser', json_encode(array('password' => '123456', 'group' => 1, 'mode' => 'account')));
|
||||
}
|
||||
|
||||
// 设置dbh属性,确保数据库连接可用
|
||||
if(empty($this->instance->dbh)) {
|
||||
$this->instance->dbh = \$this->instance->appdbh;
|
||||
$this->instance->dbh = $this->instance->appdbh;
|
||||
}
|
||||
|
||||
// 使用反射来访问protected方法
|
||||
@@ -2215,8 +2215,8 @@ class convertTaoTest extends baseTest
|
||||
{
|
||||
try {
|
||||
global $app;
|
||||
$originalJiraUser = \$this->instance->appsession->jiraUser ?? null;
|
||||
\$this->instance->appsession->set('jiraUser', array('password' => '123456', 'group' => 1, 'mode' => $mode));
|
||||
$originalJiraUser = $this->instance->appsession->jiraUser ?? null;
|
||||
$this->instance->appsession->set('jiraUser', array('password' => '123456', 'group' => 1, 'mode' => $mode));
|
||||
|
||||
$reflection = new ReflectionClass($this->instance);
|
||||
$method = $reflection->getMethod('importJiraUser');
|
||||
@@ -2226,16 +2226,16 @@ class convertTaoTest extends baseTest
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($originalJiraUser !== null) {
|
||||
\$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraUser');
|
||||
$this->instance->appsession->destroy('jiraUser');
|
||||
}
|
||||
return $result;
|
||||
} catch (Exception|Error $e) {
|
||||
if(isset($originalJiraUser) && $originalJiraUser !== null) {
|
||||
\$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
$this->instance->appsession->set('jiraUser', $originalJiraUser);
|
||||
} else {
|
||||
\$this->instance->appsession->destroy('jiraUser');
|
||||
$this->instance->appsession->destroy('jiraUser');
|
||||
}
|
||||
return get_class($e) === 'Exception' ? 'exception: ' . $e->getMessage() : 'error: ' . $e->getMessage();
|
||||
}
|
||||
@@ -2634,7 +2634,7 @@ class convertTaoTest extends baseTest
|
||||
public function processJiraIssueContentTest($issueList = array())
|
||||
{
|
||||
global $tester;
|
||||
$this->instance->dbh = \$this->instance->dbh;
|
||||
$this->instance->dbh = $this->instance->dbh;
|
||||
|
||||
$reflection = new ReflectionClass($this->instance);
|
||||
$method = $reflection->getMethod('processJiraIssueContent');
|
||||
|
||||
@@ -35,10 +35,10 @@ class epicModelTest extends baseTest
|
||||
{
|
||||
global $app, $tester;
|
||||
|
||||
// 确保\$this->instance->appcontrol存在并能加载story模型
|
||||
if(!isset(\$this->instance->appcontrol))
|
||||
// 确保$this->instance->appcontrol存在并能加载story模型
|
||||
if(!isset($this->instance->appcontrol))
|
||||
{
|
||||
\$this->instance->appcontrol = $tester;
|
||||
$this->instance->appcontrol = $tester;
|
||||
}
|
||||
|
||||
$result = $this->instance->isClickable($data, $action);
|
||||
|
||||
@@ -105,7 +105,7 @@ class kanbanTaoTest extends baseTest
|
||||
global $tester;
|
||||
|
||||
// 记录操作前的单元格数量
|
||||
$beforeCount = \$this->instance->dao->select('COUNT(1) as count')->from(TABLE_KANBANCELL)->where('`column`')->eq($childColumnID)->fetch('count');
|
||||
$beforeCount = $this->instance->dao->select('COUNT(1) as count')->from(TABLE_KANBANCELL)->where('`column`')->eq($childColumnID)->fetch('count');
|
||||
|
||||
// 使用反射来调用protected方法
|
||||
$reflection = new ReflectionClass($this->instance);
|
||||
@@ -117,7 +117,7 @@ class kanbanTaoTest extends baseTest
|
||||
if(dao::isError()) return array('success' => 0, 'error' => dao::getError());
|
||||
|
||||
// 记录操作后的单元格数量
|
||||
$afterCount = \$this->instance->dao->select('COUNT(1) as count')->from(TABLE_KANBANCELL)->where('`column`')->eq($childColumnID)->fetch('count');
|
||||
$afterCount = $this->instance->dao->select('COUNT(1) as count')->from(TABLE_KANBANCELL)->where('`column`')->eq($childColumnID)->fetch('count');
|
||||
|
||||
// 判断是否成功创建了新的单元格
|
||||
$success = $afterCount > $beforeCount ? 1 : 0;
|
||||
@@ -357,25 +357,25 @@ class kanbanTaoTest extends baseTest
|
||||
if($testType === 'singleBug')
|
||||
{
|
||||
// 获取单个Bug对象
|
||||
$bug = \$this->instance->dao->select('*')->from(TABLE_BUG)->where('id')->eq(1)->fetch();
|
||||
$bug = $this->instance->dao->select('*')->from(TABLE_BUG)->where('id')->eq(1)->fetch();
|
||||
if($bug) $objects = array($bug);
|
||||
}
|
||||
elseif($testType === 'multipleBugs')
|
||||
{
|
||||
// 获取多个Bug对象
|
||||
$objects = \$this->instance->dao->select('*')->from(TABLE_BUG)->where('id')->in('1,2,3')->fetchAll('id');
|
||||
$objects = $this->instance->dao->select('*')->from(TABLE_BUG)->where('id')->in('1,2,3')->fetchAll('id');
|
||||
}
|
||||
elseif($testType === 'bugWithDifferentStatus')
|
||||
{
|
||||
// 获取不同状态的Bug
|
||||
$bug = \$this->instance->dao->select('*')->from(TABLE_BUG)->where('status')->eq('resolved')->limit(1)->fetch();
|
||||
$bug = $this->instance->dao->select('*')->from(TABLE_BUG)->where('status')->eq('resolved')->limit(1)->fetch();
|
||||
if($bug) $objects = array($bug);
|
||||
}
|
||||
elseif($testType === 'permissionTest')
|
||||
{
|
||||
// 权限测试用例
|
||||
su('user1');
|
||||
$bug = \$this->instance->dao->select('*')->from(TABLE_BUG)->where('id')->eq(1)->fetch();
|
||||
$bug = $this->instance->dao->select('*')->from(TABLE_BUG)->where('id')->eq(1)->fetch();
|
||||
if($bug) $objects = array($bug);
|
||||
}
|
||||
|
||||
@@ -525,11 +525,11 @@ class kanbanTaoTest extends baseTest
|
||||
global $tester;
|
||||
|
||||
// 获取卡片数据
|
||||
$card = \$this->instance->dao->select('*')->from(TABLE_KANBANCARD)->where('id')->eq($cardID)->fetch();
|
||||
$card = $this->instance->dao->select('*')->from(TABLE_KANBANCARD)->where('id')->eq($cardID)->fetch();
|
||||
if(!$card) return array('error' => 'Card not found');
|
||||
|
||||
// 获取单元格数据
|
||||
$cell = \$this->instance->dao->select('*')->from(TABLE_KANBANCELL)->where('id')->eq($cellID)->fetch();
|
||||
$cell = $this->instance->dao->select('*')->from(TABLE_KANBANCELL)->where('id')->eq($cellID)->fetch();
|
||||
if(!$cell) return array('error' => 'Cell not found');
|
||||
|
||||
// 使用反射来调用protected方法
|
||||
@@ -579,7 +579,7 @@ class kanbanTaoTest extends baseTest
|
||||
global $tester;
|
||||
|
||||
// 获取待测试的列信息
|
||||
$column = \$this->instance->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('id')->eq($columnID)->fetch();
|
||||
$column = $this->instance->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('id')->eq($columnID)->fetch();
|
||||
|
||||
if(!$column) return array('result' => 0, 'error' => 'Column not found');
|
||||
|
||||
@@ -594,7 +594,7 @@ class kanbanTaoTest extends baseTest
|
||||
}
|
||||
|
||||
// 记录调用前的同父列子列数量
|
||||
$siblingCount = \$this->instance->dao->select('COUNT(1) AS count')->from(TABLE_KANBANCOLUMN)
|
||||
$siblingCount = $this->instance->dao->select('COUNT(1) AS count')->from(TABLE_KANBANCOLUMN)
|
||||
->where('parent')->eq($column->parent)
|
||||
->andWhere('id')->ne($column->id)
|
||||
->andWhere('deleted')->eq('0')
|
||||
@@ -611,7 +611,7 @@ class kanbanTaoTest extends baseTest
|
||||
if(dao::isError()) return array('result' => 0, 'error' => dao::getError());
|
||||
|
||||
// 获取父列的当前parent值
|
||||
$parentColumn = \$this->instance->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('id')->eq($column->parent)->fetch();
|
||||
$parentColumn = $this->instance->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('id')->eq($column->parent)->fetch();
|
||||
$currentParent = $parentColumn ? $parentColumn->parent : -1;
|
||||
|
||||
// 判断结果:如果没有其他兄弟列,父列的parent应该被重置为0
|
||||
@@ -639,7 +639,7 @@ class kanbanTaoTest extends baseTest
|
||||
global $tester;
|
||||
|
||||
// 获取操作前的单元格数据
|
||||
$beforeCell = \$this->instance->dao->select('*')->from(TABLE_KANBANCELL)
|
||||
$beforeCell = $this->instance->dao->select('*')->from(TABLE_KANBANCELL)
|
||||
->where('kanban')->eq($executionID)
|
||||
->andWhere('lane')->eq($laneID)
|
||||
->andWhere('`column`')->eq($colID)
|
||||
@@ -655,7 +655,7 @@ class kanbanTaoTest extends baseTest
|
||||
if(dao::isError()) return array('result' => 'error', 'message' => dao::getError());
|
||||
|
||||
// 获取操作后的单元格数据
|
||||
$afterCell = \$this->instance->dao->select('*')->from(TABLE_KANBANCELL)
|
||||
$afterCell = $this->instance->dao->select('*')->from(TABLE_KANBANCELL)
|
||||
->where('kanban')->eq($executionID)
|
||||
->andWhere('lane')->eq($laneID)
|
||||
->andWhere('`column`')->eq($colID)
|
||||
|
||||
@@ -203,12 +203,12 @@ class metricModelTest extends baseTest
|
||||
if(empty($code) || empty($cycle)) return 0;
|
||||
|
||||
// 记录删除前的数据量
|
||||
$beforeCount = \$this->instance->dao->select('COUNT(*) as count')->from(TABLE_METRICLIB)->where('metricCode')->eq($code)->fetch('count');
|
||||
$beforeCount = $this->instance->dao->select('COUNT(*) as count')->from(TABLE_METRICLIB)->where('metricCode')->eq($code)->fetch('count');
|
||||
|
||||
$this->instance->clearOutDatedRecords($code, $cycle);
|
||||
|
||||
// 记录删除后的数据量
|
||||
$afterCount = \$this->instance->dao->select('COUNT(*) as count')->from(TABLE_METRICLIB)->where('metricCode')->eq($code)->fetch('count');
|
||||
$afterCount = $this->instance->dao->select('COUNT(*) as count')->from(TABLE_METRICLIB)->where('metricCode')->eq($code)->fetch('count');
|
||||
|
||||
return $beforeCount - $afterCount;
|
||||
}
|
||||
@@ -392,7 +392,7 @@ class metricModelTest extends baseTest
|
||||
{
|
||||
if($dao === null) {
|
||||
global $tester;
|
||||
$dao = \$this->instance->dao;
|
||||
$dao = $this->instance->dao;
|
||||
}
|
||||
|
||||
$result = $this->instance->getDataset($dao);
|
||||
@@ -958,8 +958,8 @@ class metricModelTest extends baseTest
|
||||
public function processOldMetricsOpenTest()
|
||||
{
|
||||
global $config;
|
||||
$originalEdition = \$this->instance->configedition;
|
||||
\$this->instance->configedition = 'open';
|
||||
$originalEdition = $this->instance->configedition;
|
||||
$this->instance->configedition = 'open';
|
||||
|
||||
try {
|
||||
$metrics = array();
|
||||
@@ -996,7 +996,7 @@ class metricModelTest extends baseTest
|
||||
}
|
||||
finally
|
||||
{
|
||||
\$this->instance->configedition = $originalEdition;
|
||||
$this->instance->configedition = $originalEdition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1052,7 +1052,7 @@ class metricModelTest extends baseTest
|
||||
if(empty($testType))
|
||||
{
|
||||
// 测试空表情况
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->rebuildPrimaryKey();
|
||||
if(dao::isError()) return dao::getError();
|
||||
return null;
|
||||
@@ -1061,7 +1061,7 @@ class metricModelTest extends baseTest
|
||||
if($testType == 'normal')
|
||||
{
|
||||
// 清空表并插入正常数据
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
for($i = 1; $i <= 5; $i++)
|
||||
{
|
||||
$record = new stdClass();
|
||||
@@ -1071,14 +1071,14 @@ class metricModelTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = sprintf('%02d', $i);
|
||||
$record->date = '2024-01-' . sprintf('%02d', $i);
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
}
|
||||
|
||||
$this->instance->rebuildPrimaryKey();
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 验证ID是否从1开始连续
|
||||
$records = \$this->instance->dao->select('id')->from(TABLE_METRICLIB)->orderBy('id')->fetchAll();
|
||||
$records = $this->instance->dao->select('id')->from(TABLE_METRICLIB)->orderBy('id')->fetchAll();
|
||||
for($i = 0; $i < count($records); $i++)
|
||||
{
|
||||
if($records[$i]->id != ($i + 1)) return array('result' => 'failed');
|
||||
@@ -1089,7 +1089,7 @@ class metricModelTest extends baseTest
|
||||
if($testType == 'discontinuous')
|
||||
{
|
||||
// 清空表并插入不连续ID数据
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$ids = array(2, 5, 8, 12, 15);
|
||||
foreach($ids as $index => $id)
|
||||
{
|
||||
@@ -1100,15 +1100,15 @@ class metricModelTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = sprintf('%02d', $index + 1);
|
||||
$record->date = '2024-01-' . sprintf('%02d', $index + 1);
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
\$this->instance->dao->update(TABLE_METRICLIB)->set('id')->eq($id)->where('metricCode')->eq('test_metric_' . $id)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->update(TABLE_METRICLIB)->set('id')->eq($id)->where('metricCode')->eq('test_metric_' . $id)->exec();
|
||||
}
|
||||
|
||||
$this->instance->rebuildPrimaryKey();
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 验证ID是否变为连续
|
||||
$records = \$this->instance->dao->select('id')->from(TABLE_METRICLIB)->orderBy('id')->fetchAll();
|
||||
$records = $this->instance->dao->select('id')->from(TABLE_METRICLIB)->orderBy('id')->fetchAll();
|
||||
for($i = 0; $i < count($records); $i++)
|
||||
{
|
||||
if($records[$i]->id != ($i + 1)) return array('result' => 'failed');
|
||||
@@ -1119,7 +1119,7 @@ class metricModelTest extends baseTest
|
||||
if($testType == 'large')
|
||||
{
|
||||
// 清空表并插入大量数据测试
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
for($i = 1; $i <= 50; $i++)
|
||||
{
|
||||
$record = new stdClass();
|
||||
@@ -1129,15 +1129,15 @@ class metricModelTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = sprintf('%02d', $i % 28 + 1);
|
||||
$record->date = '2024-01-' . sprintf('%02d', $i % 28 + 1);
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
}
|
||||
|
||||
$this->instance->rebuildPrimaryKey();
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 验证大量数据的ID连续性
|
||||
$count = \$this->instance->dao->select('COUNT(*) as count')->from(TABLE_METRICLIB)->fetch('count');
|
||||
$maxId = \$this->instance->dao->select('MAX(id) as maxId')->from(TABLE_METRICLIB)->fetch('maxId');
|
||||
$count = $this->instance->dao->select('COUNT(*) as count')->from(TABLE_METRICLIB)->fetch('count');
|
||||
$maxId = $this->instance->dao->select('MAX(id) as maxId')->from(TABLE_METRICLIB)->fetch('maxId');
|
||||
if($count == $maxId && $count == 50) return array('result' => 'success');
|
||||
return array('result' => 'failed');
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ class metricModelTest extends baseTest
|
||||
if($testType == 'verify')
|
||||
{
|
||||
// 验证AUTO_INCREMENT值设置
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
for($i = 1; $i <= 3; $i++)
|
||||
{
|
||||
$record = new stdClass();
|
||||
@@ -1155,7 +1155,7 @@ class metricModelTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = sprintf('%02d', $i);
|
||||
$record->date = '2024-01-' . sprintf('%02d', $i);
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
}
|
||||
|
||||
$this->instance->rebuildPrimaryKey();
|
||||
@@ -1169,9 +1169,9 @@ class metricModelTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = '04';
|
||||
$record->date = '2024-01-04';
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
|
||||
$newId = \$this->instance->dao->select('id')->from(TABLE_METRICLIB)->where('metricCode')->eq('auto_increment_test')->fetch('id');
|
||||
$newId = $this->instance->dao->select('id')->from(TABLE_METRICLIB)->where('metricCode')->eq('auto_increment_test')->fetch('id');
|
||||
return array('autoIncrement' => ($newId == 4));
|
||||
}
|
||||
|
||||
@@ -1240,13 +1240,13 @@ class metricModelTest extends baseTest
|
||||
global $tester;
|
||||
|
||||
// 记录更新前有多少条 createdDate 为 null 的记录
|
||||
$beforeCount = \$this->instance->dao->select('count(*)')->from(TABLE_METRIC)->where('createdDate is null')->fetch('count(*)');
|
||||
$beforeCount = $this->instance->dao->select('count(*)')->from(TABLE_METRIC)->where('createdDate is null')->fetch('count(*)');
|
||||
|
||||
$this->instance->updateMetricDate();
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 记录更新后有多少条 createdDate 为 null 的记录
|
||||
$afterCount = \$this->instance->dao->select('count(*)')->from(TABLE_METRIC)->where('createdDate is null')->fetch('count(*)');
|
||||
$afterCount = $this->instance->dao->select('count(*)')->from(TABLE_METRIC)->where('createdDate is null')->fetch('count(*)');
|
||||
|
||||
return array('before' => $beforeCount, 'after' => $afterCount, 'updated' => $beforeCount - $afterCount);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class metricTaoTest extends baseTest
|
||||
if(empty($code)) return 'invalid_code';
|
||||
|
||||
// 记录删除前的记录数
|
||||
$beforeCount = \$this->instance->dao->select('COUNT(*) as count')
|
||||
$beforeCount = $this->instance->dao->select('COUNT(*) as count')
|
||||
->from(TABLE_METRICLIB)
|
||||
->where('metricCode')->eq($code)
|
||||
->fetch('count');
|
||||
@@ -53,7 +53,7 @@ class metricTaoTest extends baseTest
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 记录删除后的记录数
|
||||
$afterCount = \$this->instance->dao->select('COUNT(*) as count')
|
||||
$afterCount = $this->instance->dao->select('COUNT(*) as count')
|
||||
->from(TABLE_METRICLIB)
|
||||
->where('metricCode')->eq($code)
|
||||
->fetch('count');
|
||||
@@ -177,7 +177,7 @@ class metricTaoTest extends baseTest
|
||||
if(empty($code)) return 'invalid_code';
|
||||
|
||||
// 记录操作前未删除的记录数
|
||||
$beforeUndeleted = \$this->instance->dao->select('COUNT(*) as count')
|
||||
$beforeUndeleted = $this->instance->dao->select('COUNT(*) as count')
|
||||
->from(TABLE_METRICLIB)
|
||||
->where('metricCode')->eq($code)
|
||||
->andWhere('deleted')->eq('0')
|
||||
@@ -192,7 +192,7 @@ class metricTaoTest extends baseTest
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 记录操作后未删除的记录数
|
||||
$afterUndeleted = \$this->instance->dao->select('COUNT(*) as count')
|
||||
$afterUndeleted = $this->instance->dao->select('COUNT(*) as count')
|
||||
->from(TABLE_METRICLIB)
|
||||
->where('metricCode')->eq($code)
|
||||
->andWhere('deleted')->eq('0')
|
||||
@@ -220,7 +220,7 @@ class metricTaoTest extends baseTest
|
||||
if(empty($testType))
|
||||
{
|
||||
// 测试空表情况
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$method->invoke($this->instance);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return array('result' => 'empty_table');
|
||||
@@ -229,7 +229,7 @@ class metricTaoTest extends baseTest
|
||||
if($testType == 'normal')
|
||||
{
|
||||
// 清空表并插入正常数据
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
for($i = 1; $i <= 5; $i++)
|
||||
{
|
||||
$record = new stdClass();
|
||||
@@ -239,14 +239,14 @@ class metricTaoTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = sprintf('%02d', $i);
|
||||
$record->date = '2024-01-' . sprintf('%02d', $i);
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
}
|
||||
|
||||
$method->invoke($this->instance);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 验证ID是否从1开始连续
|
||||
$records = \$this->instance->dao->select('id')->from(TABLE_METRICLIB)->orderBy('id')->fetchAll();
|
||||
$records = $this->instance->dao->select('id')->from(TABLE_METRICLIB)->orderBy('id')->fetchAll();
|
||||
for($i = 0; $i < count($records); $i++)
|
||||
{
|
||||
if($records[$i]->id != ($i + 1)) return array('result' => 'failed');
|
||||
@@ -257,7 +257,7 @@ class metricTaoTest extends baseTest
|
||||
if($testType == 'discontinuous')
|
||||
{
|
||||
// 清空表并插入不连续ID数据
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$ids = array(2, 5, 8, 12, 15);
|
||||
foreach($ids as $index => $id)
|
||||
{
|
||||
@@ -268,15 +268,15 @@ class metricTaoTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = sprintf('%02d', $index + 1);
|
||||
$record->date = '2024-01-' . sprintf('%02d', $index + 1);
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
\$this->instance->dao->update(TABLE_METRICLIB)->set('id')->eq($id)->where('metricCode')->eq('test_metric_' . $id)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->update(TABLE_METRICLIB)->set('id')->eq($id)->where('metricCode')->eq('test_metric_' . $id)->exec();
|
||||
}
|
||||
|
||||
$method->invoke($this->instance);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 验证ID是否变为连续
|
||||
$records = \$this->instance->dao->select('id')->from(TABLE_METRICLIB)->orderBy('id')->fetchAll();
|
||||
$records = $this->instance->dao->select('id')->from(TABLE_METRICLIB)->orderBy('id')->fetchAll();
|
||||
for($i = 0; $i < count($records); $i++)
|
||||
{
|
||||
if($records[$i]->id != ($i + 1)) return array('result' => 'failed');
|
||||
@@ -287,7 +287,7 @@ class metricTaoTest extends baseTest
|
||||
if($testType == 'large')
|
||||
{
|
||||
// 清空表并插入大量数据测试
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
for($i = 1; $i <= 50; $i++)
|
||||
{
|
||||
$record = new stdClass();
|
||||
@@ -297,15 +297,15 @@ class metricTaoTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = sprintf('%02d', $i % 28 + 1);
|
||||
$record->date = '2024-01-' . sprintf('%02d', $i % 28 + 1);
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
}
|
||||
|
||||
$method->invoke($this->instance);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 验证大量数据的ID连续性
|
||||
$count = \$this->instance->dao->select('COUNT(*) as count')->from(TABLE_METRICLIB)->fetch('count');
|
||||
$maxId = \$this->instance->dao->select('MAX(id) as maxId')->from(TABLE_METRICLIB)->fetch('maxId');
|
||||
$count = $this->instance->dao->select('COUNT(*) as count')->from(TABLE_METRICLIB)->fetch('count');
|
||||
$maxId = $this->instance->dao->select('MAX(id) as maxId')->from(TABLE_METRICLIB)->fetch('maxId');
|
||||
if($count == $maxId && $count == 50) return array('result' => 'success');
|
||||
return array('result' => 'failed');
|
||||
}
|
||||
@@ -313,7 +313,7 @@ class metricTaoTest extends baseTest
|
||||
if($testType == 'autoincrement')
|
||||
{
|
||||
// 验证AUTO_INCREMENT值设置
|
||||
\$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
$this->instance->dao->delete()->from(TABLE_METRICLIB)->exec();
|
||||
for($i = 1; $i <= 3; $i++)
|
||||
{
|
||||
$record = new stdClass();
|
||||
@@ -323,7 +323,7 @@ class metricTaoTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = sprintf('%02d', $i);
|
||||
$record->date = '2024-01-' . sprintf('%02d', $i);
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
}
|
||||
|
||||
$method->invoke($this->instance);
|
||||
@@ -337,9 +337,9 @@ class metricTaoTest extends baseTest
|
||||
$record->month = '01';
|
||||
$record->day = '04';
|
||||
$record->date = '2024-01-04';
|
||||
\$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
$this->instance->dao->insert(TABLE_METRICLIB)->data($record)->exec();
|
||||
|
||||
$newId = \$this->instance->dao->select('id')->from(TABLE_METRICLIB)->where('metricCode')->eq('auto_increment_test')->fetch('id');
|
||||
$newId = $this->instance->dao->select('id')->from(TABLE_METRICLIB)->where('metricCode')->eq('auto_increment_test')->fetch('id');
|
||||
return array('autoIncrement' => ($newId == 4 ? '1' : '0'));
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ class metricTaoTest extends baseTest
|
||||
if(empty($code)) return 'invalid_code';
|
||||
|
||||
// 记录更新前的状态
|
||||
$beforeCount = \$this->instance->dao->select('COUNT(*) as count')
|
||||
$beforeCount = $this->instance->dao->select('COUNT(*) as count')
|
||||
->from(TABLE_METRICLIB)
|
||||
->where('metricCode')->eq($code)
|
||||
->andWhere('deleted')->eq($value)
|
||||
@@ -376,7 +376,7 @@ class metricTaoTest extends baseTest
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 记录更新后的状态
|
||||
$afterCount = \$this->instance->dao->select('COUNT(*) as count')
|
||||
$afterCount = $this->instance->dao->select('COUNT(*) as count')
|
||||
->from(TABLE_METRICLIB)
|
||||
->where('metricCode')->eq($code)
|
||||
->andWhere('deleted')->eq($value)
|
||||
|
||||
@@ -149,7 +149,7 @@ class searchModelTest extends baseTest
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$count = \$this->instance->dao->select('COUNT(1) AS count')->from(TABLE_SEARCHINDEX)->where('objectType')->eq($objectType)->andWhere('objectID')->eq($objectID)->fetch('count');
|
||||
$count = $this->instance->dao->select('COUNT(1) AS count')->from(TABLE_SEARCHINDEX)->where('objectType')->eq($objectType)->andWhere('objectID')->eq($objectID)->fetch('count');
|
||||
|
||||
return intval($count);
|
||||
}
|
||||
|
||||
@@ -513,7 +513,7 @@ class searchTaoTest extends baseTest
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
\$this->instance->app->loadClass('date');
|
||||
$this->instance->app->loadClass('date');
|
||||
|
||||
$lastWeek = date::getLastWeek();
|
||||
$thisWeek = date::getThisWeek();
|
||||
@@ -528,7 +528,7 @@ class searchTaoTest extends baseTest
|
||||
if(strpos($query, 'thisMonth') !== false) return ($replacedQuery == "date between '" . $thisMonth['begin'] . "' and '" . $thisMonth['end'] . "'") ? '1' : '0';
|
||||
if(strpos($query, 'yesterday') !== false) return ($replacedQuery == "date between '" . $yesterday . ' 00:00:00' . "' and '" . $yesterday . ' 23:59:59' . "'") ? '1' : '0';
|
||||
if(strpos($query, 'today') !== false) return ($replacedQuery == "date between '" . $today . ' 00:00:00' . "' and '" . $today . ' 23:59:59' . "'") ? '1' : '0';
|
||||
if(strpos($query, '$@me') !== false) return str_replace('$@me', \$this->instance->app->user->account, $query);
|
||||
if(strpos($query, '$@me') !== false) return str_replace('$@me', $this->instance->app->user->account, $query);
|
||||
|
||||
return $replacedQuery;
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ class storyTaoTest extends baseTest
|
||||
{
|
||||
global $tester;
|
||||
$users['admin'] = '管理员';
|
||||
$story = \$this->instance->loadModel('story')->getById($storyID);
|
||||
$story = $this->instance->loadModel('story')->getById($storyID);
|
||||
return $this->instance->getAffectedBugs($story, $users);
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ class storyTaoTest extends baseTest
|
||||
{
|
||||
global $tester;
|
||||
$users['admin'] = '管理员';
|
||||
$story = \$this->instance->loadModel('story')->getById($storyID);
|
||||
$story = $this->instance->loadModel('story')->getById($storyID);
|
||||
return $this->instance->getAffectedCases($story, $users);
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ class storyTaoTest extends baseTest
|
||||
{
|
||||
global $tester;
|
||||
$users['admin'] = '管理员';
|
||||
$story = \$this->instance->loadModel('story')->getById($storyID);
|
||||
$story = $this->instance->loadModel('story')->getById($storyID);
|
||||
return $this->instance->getAffectedProjects($story, $users);
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ class storyTaoTest extends baseTest
|
||||
{
|
||||
global $tester;
|
||||
$users['admin'] = '管理员';
|
||||
$story = \$this->instance->loadModel('story')->getById($storyID);
|
||||
$story = $this->instance->loadModel('story')->getById($storyID);
|
||||
return $this->instance->getAffectedTwins($story, $users);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class tutorialModelTest extends baseTest
|
||||
public function checkNoviceTest(int $modifyPassword): int|array
|
||||
{
|
||||
global $tester;
|
||||
if(\$this->instance->app->user->account != 'guest') \$this->instance->app->user->modifyPassword = $modifyPassword;
|
||||
if($this->instance->app->user->account != 'guest') $this->instance->app->user->modifyPassword = $modifyPassword;
|
||||
|
||||
$return = $this->instance->checkNovice();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user