- Remove unit test of bugModel-batchCreate.
This commit is contained in:
@@ -45,87 +45,6 @@ class bugTest
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试批量创建bug。
|
||||
* Test batch create bugs.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param array $param
|
||||
* @param array $output
|
||||
* @param array|false $uploadImages
|
||||
* @param array|false $bugImagesFiles
|
||||
* @access public
|
||||
* @return array|object|string
|
||||
*/
|
||||
public function batchCreateObject(int $productID, array $param = array(), array $output = array(), array|bool $uploadImages = false, array|bool $bugImagesFiles = false): array|object|string
|
||||
{
|
||||
$_SERVER['HTTP_HOST'] = '';
|
||||
|
||||
$modules = array('0', '0', '0');
|
||||
$executions = array('11', '11', '11');
|
||||
$openedBuilds = array('', '', '');
|
||||
$deadlines = array('2023-01-01', '2023-01-01', '2023-01-01');
|
||||
$stepses = array('', '', '');
|
||||
$types = array('', '', '');
|
||||
$severities = array(3, 3, 3);
|
||||
$oses = array('', '', '');
|
||||
$browsers = array('', '', '');
|
||||
$pris = array(3, 3, 3);
|
||||
$color = array('', '', '');
|
||||
$keywords = array('', '', '');
|
||||
|
||||
$bugs = array();
|
||||
foreach($param['title'] as $index => $title)
|
||||
{
|
||||
$bug = new stdclass();
|
||||
$bug->title = $title;
|
||||
$bug->product = $productID;
|
||||
$bug->module = isset($param['modules']) ? $param['modules'][$index] : $modules[$index];
|
||||
$bug->execution = isset($param['executions']) ? $param['executions'][$index] : $executions[$index];
|
||||
$bug->openedBuild = isset($param['openedBuilds']) ? $param['openedBuilds'][$index] : $openedBuilds[$index];
|
||||
$bug->deadline = isset($param['deadlines']) ? $param['deadlines'][$index] : $deadlines[$index];
|
||||
$bug->steps = isset($param['stepses']) ? $param['stepses'][$index] : $stepses[$index];
|
||||
$bug->type = isset($param['types']) ? $param['types'][$index] : $types[$index];
|
||||
$bug->severity = isset($param['severities']) ? $param['severities'][$index] : $severities[$index];
|
||||
$bug->os = isset($param['oses']) ? $param['oses'][$index] : $oses[$index];
|
||||
$bug->browser = isset($param['browsers']) ? $param['browsers'][$index] : $browsers[$index];
|
||||
$bug->pri = isset($param['pris']) ? $param['pris'][$index] : $pris[$index];
|
||||
$bug->color = isset($param['color']) ? $param['color'][$index] : $color[$index];
|
||||
$bug->keywords = isset($param['keywords']) ? $param['keywords'][$index] : $keywords[$index];
|
||||
if(isset($param['laneID'])) $bug->laneID = $param['laneID'][$index];
|
||||
if(is_array($bug->openedBuild)) $bug->openedBuild = implode(',', $bug->openedBuild);
|
||||
|
||||
$bugs[] = $bug;
|
||||
}
|
||||
|
||||
$object = $this->objectModel->batchCreate($bugs, $productID, $output, $uploadImages, $bugImagesFiles);
|
||||
|
||||
$bugs = array();
|
||||
if(is_array($object))
|
||||
{
|
||||
foreach($object as $bugID => $actionID)
|
||||
{
|
||||
$bugs[] = $this->objectModel->getByID($bugID);
|
||||
}
|
||||
}
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$return = '';
|
||||
$errors = dao::getError();
|
||||
foreach($errors as $key => $value)
|
||||
{
|
||||
if(is_string($value)) $return .= "{$value}";
|
||||
if(is_array($value)) $return .= implode('', $value);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return empty($bugs) ? $object : $bugs;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试gitlab问题转bug。
|
||||
* Test create bug from gitlab issue.
|
||||
|
||||
Reference in New Issue
Block a user