+ [misc] Add unit tests for convertModel::checkImportJira() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -517,4 +517,39 @@ class convertTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test checkImportJira method.
|
||||
*
|
||||
* @param string $step
|
||||
* @param array $postData
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function checkImportJiraTest($step = '', $postData = array())
|
||||
{
|
||||
// 备份原始POST数据
|
||||
$originalPost = $_POST;
|
||||
|
||||
// 设置测试POST数据
|
||||
$_POST = $postData;
|
||||
|
||||
try {
|
||||
$result = $this->objectModel->checkImportJira($step);
|
||||
if(dao::isError()) {
|
||||
$errors = dao::getError();
|
||||
// 恢复原始POST数据
|
||||
$_POST = $originalPost;
|
||||
return $errors;
|
||||
}
|
||||
|
||||
// 恢复原始POST数据
|
||||
$_POST = $originalPost;
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
// 恢复原始POST数据
|
||||
$_POST = $originalPost;
|
||||
return 'exception: ' . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 convertModel::checkImportJira();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行convertTest模块的checkImportJiraTest方法,参数是'object', array @1
|
||||
- 执行convertTest模块的checkImportJiraTest方法,参数是'object', array 属性message @『禅道对象』不能为空。
|
||||
- 执行convertTest模块的checkImportJiraTest方法,参数是'object', array @1
|
||||
- 执行convertTest模块的checkImportJiraTest方法,参数是'status', array @1
|
||||
- 执行convertTest模块的checkImportJiraTest方法,参数是'', array @1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/convert.unittest.class.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
$convertTest = new convertTest();
|
||||
|
||||
r($convertTest->checkImportJiraTest('object', array('jiraObject' => array('1', '2'), 'zentaoObject' => array('1' => 'story', '2' => 'task')))) && p() && e('1');
|
||||
r($convertTest->checkImportJiraTest('object', array('jiraObject' => array('1', '2'), 'zentaoObject' => array('1' => 'story', '2' => '')))) && p('message') && e('『禅道对象』不能为空。');
|
||||
r($convertTest->checkImportJiraTest('object', array('jiraObject' => array(), 'zentaoObject' => array()))) && p() && e('1');
|
||||
r($convertTest->checkImportJiraTest('status', array('jiraObject' => array('1'), 'zentaoObject' => array('1' => 'story')))) && p() && e('1');
|
||||
r($convertTest->checkImportJiraTest('', array('jiraObject' => array('1'), 'zentaoObject' => array('1' => 'story')))) && p() && e('1');
|
||||
Reference in New Issue
Block a user