* [misc] Enhance unit tests for repoModel::updateCommitCount() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,29 +1,39 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/repo.unittest.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 repoModel->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计数
|
||||
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:更新另一个版本库的提交计数
|
||||
Reference in New Issue
Block a user