* Adjust unit cases and fix bug.
This commit is contained in:
@@ -87,6 +87,8 @@ class mrModel extends model
|
||||
$MR = fixer::input('post')
|
||||
->setDefault('jobID', 0)
|
||||
->setDefault('repoID', 0)
|
||||
->setDefault('sourceProject,targetProject', 0)
|
||||
->setDefault('sourceBranch,targetBranch', '')
|
||||
->setDefault('removeSourceBranch','0')
|
||||
->setDefault('needCI', 0)
|
||||
->add('createdBy', $this->app->user->account)
|
||||
|
||||
@@ -1671,16 +1671,16 @@ class repoModel extends model
|
||||
|
||||
if($objects['stories'])
|
||||
{
|
||||
$productsAndExecutions = $this->getTaskProductsAndExecutions($objects['stories']);
|
||||
$stories = $this->loadModel('story')->getByList($objects['stories']);
|
||||
foreach($objects['stories'] as $storyID)
|
||||
{
|
||||
$storyID = (int)$storyID;
|
||||
if(!isset($productsAndExecutions[$storyID])) continue;
|
||||
if(!isset($stories[$storyID])) continue;
|
||||
|
||||
$action->objectType = 'story';
|
||||
$action->objectID = $storyID;
|
||||
$action->product = $productsAndExecutions[$storyID]['product'];
|
||||
$action->execution = $productsAndExecutions[$storyID]['execution'];
|
||||
$action->product = $stories[$storyID]->product;
|
||||
$action->execution = 0;
|
||||
|
||||
$this->saveRecord($action, $changes);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,13 @@ r($result) && p() && e('fail'); //使用正确的RepoUrl,错误的分支数据
|
||||
dao::$errors = array();
|
||||
$_POST['data']['RepoSrcBranch'] = 'master';
|
||||
$_POST['data']['RepoDistBranch'] = 'master';
|
||||
|
||||
/* Get same opened MR and close it.*/
|
||||
$gitlabID = 1;
|
||||
$projectID = 42;
|
||||
$oldMR = $mrModel->apiGetSameOpened($gitlabID, $projectID, 'master', $projectID, 'master');
|
||||
if($oldMR) $mrModel->apiCloseMR(1, 42, $oldMR->iid);
|
||||
|
||||
$result = $mrModel->apiCreate();
|
||||
if($result) $result = 'success';
|
||||
r($result) && p() && e('success'); //使用源分支和目标分支一样的数据创建mr请求
|
||||
@@ -46,6 +53,9 @@ r($result) && p() && e('success'); //使用源分支和目标分支一样的数
|
||||
dao::$errors = array();
|
||||
$_POST['data']['RepoSrcBranch'] = 'branch-08';
|
||||
$_POST['data']['RepoDistBranch'] = 'master';
|
||||
$oldMR = $mrModel->apiGetSameOpened($gitlabID, $projectID, 'branch-08', $projectID, 'master');
|
||||
if($oldMR) $mrModel->apiCloseMR(1, 42, $oldMR->iid);
|
||||
|
||||
$result = $mrModel->apiCreate();
|
||||
if($result) $result = 'success';
|
||||
r($result) && p() && e('success'); //使用正确的数据创建mr请求
|
||||
|
||||
@@ -35,7 +35,7 @@ $_POST['assignee'] = '';
|
||||
$_POST['removeSourceBranch'] = '1';
|
||||
$result = $mrModel->create();
|
||||
if($result['result'] == 'success') $result = 'success';
|
||||
$result = preg_match('/通过API创建合并请求失败,失败原因:存在另外一个同样的合并请求在源项目分支中: !([0-9]+)/', $result['message'], $matches); //检查错误原因是否是已存在一样的mr请求
|
||||
$result = preg_match('/存在另外一个同样的合并请求在源项目分支中/', $result['message'], $matches); //检查错误原因是否是已存在一样的mr请求
|
||||
if($result) $result = 'success';
|
||||
r($result) && p() && e('success'); //使用正确的repoID, gitlabID。POST数据正确 或者错误原因为已存在一样的mr请求
|
||||
|
||||
|
||||
Reference in New Issue
Block a user