* [misc] Enhance unit tests for repoModel::getHistory() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,22 +1,28 @@
|
||||
#!/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->getHistory();
|
||||
title=测试 repoModel::getHistory();
|
||||
timeout=0
|
||||
cid=1
|
||||
cid=0
|
||||
|
||||
- 查询全部提交信息属性revision @2e0dd521b4a29930d5670a2c142a4400d7cffc1a
|
||||
- 传空数据查询信息 @empty
|
||||
- 步骤1:正常查询有效revision列表 @2e0dd521b4a29930d5670a2c142a4400d7cffc1a
|
||||
- 步骤2:查询空revision数组 @empty
|
||||
- 步骤3:查询不存在的revision @empty
|
||||
- 步骤4:测试无效repoID参数 @empty
|
||||
- 步骤5:测试单个revision查询 @2e0dd521b4a29930d5670a2c142a4400d7cffc1a
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/repo.unittest.class.php';
|
||||
|
||||
zenData('repo')->loadYaml('repo')->gen(4);
|
||||
zenData('repohistory')->gen(0);
|
||||
zenData('repobranch')->gen(0);
|
||||
|
||||
su('admin');
|
||||
|
||||
global $tester, $dao;
|
||||
$repo = $tester->loadModel('repo')->getByID(1);
|
||||
@@ -32,6 +38,8 @@ foreach($logs as $log)
|
||||
|
||||
$repoTest = new repoTest();
|
||||
|
||||
$result = $repoTest->getHistoryTest(1, $revisions);
|
||||
r(array_shift($result)) && p('revision') && e('2e0dd521b4a29930d5670a2c142a4400d7cffc1a'); //查询全部提交信息
|
||||
r($repoTest->getHistoryTest(1, array())) && p('') && e('empty'); //传空数据查询信息
|
||||
r($repoTest->getHistoryTest(1, $revisions)) && p('0') && e('2e0dd521b4a29930d5670a2c142a4400d7cffc1a'); // 步骤1:正常查询有效revision列表
|
||||
r($repoTest->getHistoryTest(1, array())) && p() && e('empty'); // 步骤2:查询空revision数组
|
||||
r($repoTest->getHistoryTest(1, array('nonexistent123', 'invalid456'))) && p() && e('empty'); // 步骤3:查询不存在的revision
|
||||
r($repoTest->getHistoryTest(999, $revisions)) && p() && e('empty'); // 步骤4:测试无效repoID参数
|
||||
r($repoTest->getHistoryTest(1, array_slice($revisions, 0, 1))) && p('0') && e('2e0dd521b4a29930d5670a2c142a4400d7cffc1a'); // 步骤5:测试单个revision查询
|
||||
Reference in New Issue
Block a user