From af7a37ba262ae6d198318adfc865a2e7811aab97 Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 10 Sep 2025 15:39:05 +0800 Subject: [PATCH] + [misc] Add unit tests for tutorialModel::getTestReports() 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/gettestreports.php | 33 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 module/tutorial/test/model/gettestreports.php diff --git a/module/tutorial/test/lib/tutorial.unittest.class.php b/module/tutorial/test/lib/tutorial.unittest.class.php index 3eda3fa0a6..a4dbc01ed3 100644 --- a/module/tutorial/test/lib/tutorial.unittest.class.php +++ b/module/tutorial/test/lib/tutorial.unittest.class.php @@ -616,4 +616,19 @@ class tutorialTest return $result; } + + /** + * 测试获取新手模式测试报告列表。 + * Test get testreports. + * + * @access public + * @return array + */ + public function getTestReportsTest(): array + { + $result = $this->objectModel->getTestReports(); + if(dao::isError()) return dao::getError(); + + return $result; + } } diff --git a/module/tutorial/test/model/gettestreports.php b/module/tutorial/test/model/gettestreports.php new file mode 100755 index 0000000000..e9ca1028eb --- /dev/null +++ b/module/tutorial/test/model/gettestreports.php @@ -0,0 +1,33 @@ +#!/usr/bin/env php +getTestReportsTest())) && p() && e('1'); // 步骤1:验证返回数组包含1个元素 +r($tutorialTest->getTestReportsTest()) && p('1:id') && e('1'); // 步骤2:验证包含ID为1的测试报告 +r($tutorialTest->getTestReportsTest()) && p('1:title') && e('Test testreport'); // 步骤3:验证测试报告标题 +r($tutorialTest->getTestReportsTest()) && p('1:objectType') && e('execution'); // 步骤4:验证对象类型 +r($tutorialTest->getTestReportsTest()) && p('1:objectID') && e('3'); // 步骤5:验证对象ID \ No newline at end of file