* Adjust unit test of the mr module.
This commit is contained in:
@@ -31,27 +31,18 @@ $mrModel = new mrTest();
|
||||
$hostID = array
|
||||
(
|
||||
'gitlab' => 1,
|
||||
'gitea' => 4,
|
||||
'gogs' => 5,
|
||||
'error' => 10
|
||||
);
|
||||
|
||||
$projectID = array
|
||||
(
|
||||
'gitlab' => 3,
|
||||
'gitea' => 'gitea/unittest',
|
||||
'gogs' => 'easycorp/unittest',
|
||||
);
|
||||
|
||||
$mrID = array
|
||||
(
|
||||
'gitlab' => 114,
|
||||
'gitea' => 20,
|
||||
'gogs' => 20,
|
||||
);
|
||||
|
||||
r($mrModel->apiCloseMrTester($hostID['error'], $projectID['gitlab'], $mrID['gitlab'])) && p() && e('0'); // 不存在的主机
|
||||
|
||||
r($mrModel->apiCloseMrTester($hostID['gitlab'], $projectID['gitlab'], $mrID['gitlab'])) && p('title,state') && e('test,closed'); // 重新打开并关闭Gitlab合并请求
|
||||
r($mrModel->apiCloseMrTester($hostID['gitea'], $projectID['gitea'], $mrID['gitea'])) && p('title,state') && e('test,closed'); // 重新打开并关闭Gitea合并请求
|
||||
r($mrModel->apiCloseMrTester($hostID['gogs'], $projectID['gogs'], $mrID['gogs'])) && p('title,state') && e('test,closed'); // 重新打开并关闭Gogs合并请求
|
||||
@@ -51,21 +51,21 @@ $oldMR['gitlab']->title = 'test-merge(不要关闭或删除)';
|
||||
$oldMR['gitlab']->hostID = 1;
|
||||
$oldMR['gitlab']->sourceProject = 3;
|
||||
$oldMR['gitlab']->targetBranch = 'master';
|
||||
$oldMR['gitlab']->id = 36;
|
||||
$oldMR['gitlab']->mriid = 36;
|
||||
|
||||
$oldMR['gitea'] = new stdclass();
|
||||
$oldMR['gitea']->title = '更新 LICENSE(不要删除)';
|
||||
$oldMR['gitea']->hostID = 4;
|
||||
$oldMR['gitea']->sourceProject = 'gitea/unittest';
|
||||
$oldMR['gitea']->targetBranch = 'test1';
|
||||
$oldMR['gitea']->id = 11;
|
||||
$oldMR['gitea']->mriid = 11;
|
||||
|
||||
$oldMR['gogs'] = new stdclass();
|
||||
$oldMR['gogs']->title = 'test(不要删除)';
|
||||
$oldMR['gogs']->hostID = 5;
|
||||
$oldMR['gogs']->sourceProject = 'easycorp/unittest';
|
||||
$oldMR['gogs']->targetBranch = 'master';
|
||||
$oldMR['gogs']->id = 7;
|
||||
$oldMR['gogs']->mriid = 7;
|
||||
|
||||
r($mrModel->apiUpdateMrTester($oldMR['gitlab'], $newMR)) && p('oldTitle,title') && e('test-merge(不要关闭或删除),test'); // 正确的数据更新Gitlab合并请求
|
||||
r($mrModel->apiUpdateMrTester($oldMR['gitea'], $newMR)) && p('oldTitle,title') && e('更新 LICENSE(不要删除),test'); // 正确的数据更新Gitea合并请求
|
||||
@@ -78,4 +78,4 @@ $oldMR['gitea']->sourceProject = '1';
|
||||
r($mrModel->apiUpdateMrTester($oldMR['gitea'], $newMR)) && p() && e('0'); // 错误的数据更新Gitea合并请求
|
||||
|
||||
$oldMR['gogs']->sourceProject = '1';
|
||||
r($mrModel->apiUpdateMrTester($oldMR['gogs'], $newMR)) && p() && e('0'); // 错误的数据更新Gogs合并请求
|
||||
r($mrModel->apiUpdateMrTester($oldMR['gogs'], $newMR)) && p() && e('0'); // 错误的数据更新Gogs合并请求
|
||||
|
||||
Reference in New Issue
Block a user