From e3bee1879c40145352b70ea56b043422ea9fcc77 Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 23 Sep 2025 13:20:23 +0800 Subject: [PATCH] * [misc] Enhance unit tests for repoModel::updateCommitCount() method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- module/repo/test/model/updatecommitcount.php | 36 +++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/module/repo/test/model/updatecommitcount.php b/module/repo/test/model/updatecommitcount.php index 8dea9b18fe..b12984827b 100755 --- a/module/repo/test/model/updatecommitcount.php +++ b/module/repo/test/model/updatecommitcount.php @@ -1,29 +1,39 @@ #!/usr/bin/env php updateCommitCount(); +title=测试 repoModel::updateCommitCount(); timeout=0 -cid=1 +cid=0 -- 设置版本库1 commit计数 +- 测试步骤1:正常更新版本库提交计数 - 属性id @1 - - 属性commits @5 -- 设置版本库2 commit计数 + - 属性commits @100 +- 测试步骤2:更新提交计数为0 - 属性id @2 - - 属性commits @20 + - 属性commits @0 +- 测试步骤3:更新提交计数为极大值 + - 属性id @3 + - 属性commits @999999 +- 测试步骤4:更新不存在的版本库ID @0 +- 测试步骤5:更新另一个版本库的提交计数 + - 属性id @4 + - 属性commits @1000 */ +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/repo.unittest.class.php'; + zenData('repo')->loadYaml('repo')->gen(5); -$repo = new repoTest(); +su('admin'); -$repoIds = array(1, 2); +$repoTest = new repoTest(); -r($repo->updateCommitCountTest($repoIds[0], 5)) && p('id,commits') && e('1,5'); //设置版本库1 commit计数 -r($repo->updateCommitCountTest($repoIds[1], 20)) && p('id,commits') && e('2,20'); //设置版本库2 commit计数 \ No newline at end of file +r($repoTest->updateCommitCountTest(1, 100)) && p('id,commits') && e('1,100'); // 测试步骤1:正常更新版本库提交计数 +r($repoTest->updateCommitCountTest(2, 0)) && p('id,commits') && e('2,0'); // 测试步骤2:更新提交计数为0 +r($repoTest->updateCommitCountTest(3, 999999)) && p('id,commits') && e('3,999999'); // 测试步骤3:更新提交计数为极大值 +r($repoTest->updateCommitCountTest(999, 50)) && p() && e('0'); // 测试步骤4:更新不存在的版本库ID +r($repoTest->updateCommitCountTest(4, 1000)) && p('id,commits') && e('4,1000'); // 测试步骤5:更新另一个版本库的提交计数 \ No newline at end of file