From 2f1a12478c0a30e1958a381b8a8ea6b559b1a11d Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 10 Sep 2025 15:06:12 +0800 Subject: [PATCH] + [misc] Add unit tests for tutorialModel::getResults() 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 --- .../test/lib/tutorial.unittest.class.php | 15 ++++++++++ module/tutorial/test/model/getresults.php | 29 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 module/tutorial/test/model/getresults.php diff --git a/module/tutorial/test/lib/tutorial.unittest.class.php b/module/tutorial/test/lib/tutorial.unittest.class.php index 456b5386c3..ecc49bcb6f 100644 --- a/module/tutorial/test/lib/tutorial.unittest.class.php +++ b/module/tutorial/test/lib/tutorial.unittest.class.php @@ -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; + } } diff --git a/module/tutorial/test/model/getresults.php b/module/tutorial/test/model/getresults.php new file mode 100755 index 0000000000..3df77ef868 --- /dev/null +++ b/module/tutorial/test/model/getresults.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +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'); \ No newline at end of file