+ [misc] Add unit tests for tutorialModel::getResults() 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:26 +08:00
co-authored by Claude
parent d625ad8f19
commit 2f1a12478c
2 changed files with 44 additions and 0 deletions
@@ -541,4 +541,19 @@ class tutorialTest
return $result;
}
/**
* 测试获取新手模式用例执行结果列表。
* Test get results.
*
* @access public
* @return array
*/
public function getResultsTest(): array
{
$result = $this->objectModel->getResults();
if(dao::isError()) return dao::getError();
return $result;
}
}
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
/**
title=测试 tutorialModel::getResults();
timeout=0
cid=0
- 执行tutorialTest模块的getResultsTest方法 @1
- 执行tutorialTest模块的getResultsTest方法 第1条的id属性 @1
- 执行tutorialTest模块的getResultsTest方法 第1条的caseResult属性 @fail
- 执行tutorialTest模块的getResultsTest方法 第1条的lastRunner属性 @admin
- 执行getResultsTest()[1]模块的stepResults方法 @2
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/tutorial.unittest.class.php';
su('admin');
$tutorialTest = new tutorialTest();
r(count($tutorialTest->getResultsTest())) && p() && e('1');
r($tutorialTest->getResultsTest()) && p('1:id') && e('1');
r($tutorialTest->getResultsTest()) && p('1:caseResult') && e('fail');
r($tutorialTest->getResultsTest()) && p('1:lastRunner') && e('admin');
r(count($tutorialTest->getResultsTest()[1]->stepResults)) && p() && e('2');