From 176daf52f193b73f7fb5d6f07c2d2b8e36fc7448 Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 10 Sep 2025 14:24:26 +0800 Subject: [PATCH] + [misc] Add unit tests for tutorialModel::getStages() 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/getstages.php | 33 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 module/tutorial/test/model/getstages.php diff --git a/module/tutorial/test/lib/tutorial.unittest.class.php b/module/tutorial/test/lib/tutorial.unittest.class.php index 8dab4fd2db..96146a6ac2 100644 --- a/module/tutorial/test/lib/tutorial.unittest.class.php +++ b/module/tutorial/test/lib/tutorial.unittest.class.php @@ -391,4 +391,19 @@ class tutorialTest return $result; } + + /** + * 测试获取新手模式阶段列表。 + * Test get tutorial stages. + * + * @access public + * @return array + */ + public function getStagesTest(): array + { + $result = $this->objectModel->getStages(); + if(dao::isError()) return dao::getError(); + + return $result; + } } diff --git a/module/tutorial/test/model/getstages.php b/module/tutorial/test/model/getstages.php new file mode 100755 index 0000000000..ace425810f --- /dev/null +++ b/module/tutorial/test/model/getstages.php @@ -0,0 +1,33 @@ +#!/usr/bin/env php +getStagesTest()) && p('3:id') && e('3'); // 步骤1:验证返回数组包含ID为3的阶段 +r($tutorialTest->getStagesTest()) && p('3:name') && e('Development stage'); // 步骤2:验证阶段名称 +r($tutorialTest->getStagesTest()) && p('3:type') && e('dev'); // 步骤3:验证阶段类型 +r($tutorialTest->getStagesTest()) && p('3:percent') && e('50'); // 步骤4:验证阶段百分比 +r($tutorialTest->getStagesTest()) && p('3:projectType') && e('waterfall'); // 步骤5:验证阶段项目类型 \ No newline at end of file