+ [misc] Add unit tests for tutorialModel::getRepo() method

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-09-15 15:06:27 +08:00
co-authored by Claude
parent 4178be92ea
commit a41b45a807
2 changed files with 49 additions and 0 deletions
@@ -1320,4 +1320,18 @@ class tutorialTest
return $result;
}
/**
* Test getRepo method.
*
* @access public
* @return object
*/
public function getRepoTest(): object
{
$result = $this->objectModel->getRepo();
if(dao::isError()) return dao::getError();
return $result;
}
}
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php
/**
title=测试 tutorialModel::getRepo();
timeout=0
cid=0
- 执行tutorialTest模块的getRepoTest方法
- 属性id @1
- 属性name @Test repo
- 执行tutorialTest模块的getRepoTest方法
- 属性SCM @Git
- 属性encoding @utf-8
- 执行tutorialTest模块的getRepoTest方法 属性product @1
- 执行tutorialTest模块的getRepoTest方法 属性deleted @0
- 执行tutorialTest模块的getRepoTest方法
- 属性commits @1
- 属性synced @0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/tutorial.unittest.class.php';
su('admin');
$tutorialTest = new tutorialTest();
r($tutorialTest->getRepoTest()) && p('id,name') && e('1,Test repo');
r($tutorialTest->getRepoTest()) && p('SCM,encoding') && e('Git,utf-8');
r($tutorialTest->getRepoTest()) && p('product') && e('1');
r($tutorialTest->getRepoTest()) && p('deleted') && e('0');
r($tutorialTest->getRepoTest()) && p('commits,synced') && e('1,0');