* Adjust unit test case for repo.

This commit is contained in:
caoyanyi
2024-03-27 16:51:10 +08:00
parent 1d2e0f32f5
commit 2263363be8
8 changed files with 30 additions and 8 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ $repo->name = 'abc&&';
$repo->serviceHost = 1;
$repo->path = 'unit_test_project17';
$repo->desc = 'unit_test_project desc';
$repo->namespace = 1;
$repo->namespace = '1';
$repo->SCM = 'Gitlab';
$repo->acl = '{"acl":"open","groups":[""],"users":[""]}';
@@ -10,9 +10,9 @@ title=- 获取任务关联信息第8条的title属性 @
timeout=0
cid=8
- 获取任务关联信息第8条的type属性 @task
- 获取任务关联信息第4条的id属性 @4
- 获取任务关联信息第10条的type属性 @story
- 获取任务关联信息第0条的type属性 @task
- 获取任务关联信息第0条的id属性 @4
- 获取任务关联信息第0条的type属性 @story
*/
@@ -23,11 +23,14 @@ zdTable('relation')->config('relation')->gen(3);
zdTable('repo')->config('config')->gen(4);
zdTable('repohistory')->config('repohistory')->gen(1);
global $tester, $app;
$repo = $tester->loadModel('repo');
include($app->getModuleRoot() . '/repo/control.php');
$app->control = new repo();
$repoID = 1;
$commit = 'c808480afe22d3a55d94e91c59a8f3170212ade0';
r($repo->getRelationByCommit($repoID, $commit, 'task')) && p('8:type') && e('task'); //获取任务关联信息
r($repo->getRelationByCommit($repoID, $commit, 'bug')) && p('4:id') && e('4'); //获取任务关联信息
r($repo->getRelationByCommit($repoID, $commit, 'story')) && p('10:type') && e('story'); //获取任务关联信息
r($repo->getRelationByCommit($repoID, $commit, 'task')) && p('0:type') && e('task'); //获取任务关联信息
r($repo->getRelationByCommit($repoID, $commit, 'bug')) && p('0:id') && e('4'); //获取任务关联信息
r($repo->getRelationByCommit($repoID, $commit, 'story')) && p('0:type') && e('story'); //获取任务关联信息
+4
View File
@@ -140,6 +140,10 @@ $data = '{
}
}';
global $app;
include($app->getModuleRoot() . '/repo/control.php');
$app->control = new repo();
$repo = new repoTest();
$repo->handleWebhookTest($event, json_decode($data), $repoID);
$result = $tester->loadModel('task')->getById(8);
@@ -60,6 +60,9 @@ global $app;
$app->rawModule = 'repo';
$app->rawMethod = 'browse';
include($app->getModuleRoot() . '/repo/control.php');
$app->control = new repo();
$repoID = 1;
$repoRoot = '';
$scm = 'gitlab';
@@ -44,6 +44,10 @@ $action->date = '2023-12-29 13:14:36';
$action->extra = $scm == 'svn' ? $log->revision : substr($log->revision, 0, 10);
$action->action = 'gitcommited';
global $app;
include($app->getModuleRoot() . '/repo/control.php');
$app->control = new repo();
$repo = new repoTest();
$repo->saveEffortForCommitTest($log, $action, $repoID);
$result = $tester->loadModel('task')->getById(8);
@@ -46,6 +46,10 @@ $action->date = '2023-12-29 13:14:36';
$action->extra = $scm == 'svn' ? $log->revision : substr($log->revision, 0, 10);
$action->action = 'gitcommited';
global $app;
include($app->getModuleRoot() . '/repo/control.php');
$app->control = new repo();
$repo = new repoTest();
$repo->setBugStatusByCommitTest($log, $action, $repoID);
$result = $tester->loadModel('bug')->getByIdList(array(1,2));
@@ -73,6 +73,10 @@ $action->date = '2023-12-29 13:14:36';
$action->extra = $scm == 'svn' ? $log->revision : substr($log->revision, 0, 10);
$action->action = 'gitcommited';
global $app;
include($app->getModuleRoot() . '/repo/control.php');
$app->control = new repo();
$repo = new repoTest();
$repo->setTaskByCommitTest($log, $action, $repoID);
$result = $tester->loadModel('task')->getById(1);
+1 -1
View File
@@ -843,7 +843,7 @@ class repoTest
$scm = $this->objectModel->app->loadClass('scm');
$repo = $this->objectModel->getByID($repoID);
$scm->setEngine($repo);
$diffs = $scm->diff('', $oldRevision, $newRevision, 'yes', 'isBranchOrTag');
$diffs = $scm->diff('', $oldRevision, $newRevision);
$diffs = $this->objectModel->getApposeDiff($diffs);
return $diffs;