* Adjust unit test case for git->updateCommit.

This commit is contained in:
caoyanyi
2023-12-22 18:36:12 +08:00
parent d213f5377b
commit be1482d466
2 changed files with 28 additions and 27 deletions
+17 -11
View File
@@ -1,25 +1,31 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/git.class.php';
su('admin');
/**
title=测试gitModel->updatecommit();
title=gitModel->updateCommit();
timeout=0
cid=1
- 测试正常的版本库 @1
- 测试空的版本库 @0
- 未同步的代码库 @0
- 已同步的代码库
- 属性id @3
- 属性repo @1
- 属性commit @3
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/git.class.php';
$repo = zdTable('repo')->config('repo');
$repo->path->range('https://gitlabdev.qc.oop.cc/root/unittest1');
$repo->gen(3);
zdTable('repohistory')->config('repohistory')->gen(1);
su('admin');
$git = new gitTest();
$repo = $tester->dao->select('*')->from(TABLE_REPO)->limit(1)->fetch();
if(strtolower($repo->SCM) == 'gitlab') $repo = $tester->loadModel('repo')->processGitlab($repo);
r($git->updateCommit($repo)) && p() && e(1); // 测试正常的版本库
r($git->updateCommitTest(2)) && p() && e('0'); // 未同步的代码库
$repo = new stdclass();
r($git->updateCommit($repo)) && p() && e(0); // 测试空的版本库
r($git->updateCommitTest(1)) && p('id,repo,commit') && e('1,1,1'); // 已同步的代码库