From 69b33f9d63209e42847389a0a2357ca67b0b9268 Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 10 Sep 2025 13:53:25 +0800 Subject: [PATCH] + [misc] Add unit tests for tutorialModel::getStoryPairs() 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/getstoryPairs.php | 34 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100755 module/tutorial/test/model/getstoryPairs.php diff --git a/module/tutorial/test/lib/tutorial.unittest.class.php b/module/tutorial/test/lib/tutorial.unittest.class.php index e1a260e9a3..94f31eaba0 100644 --- a/module/tutorial/test/lib/tutorial.unittest.class.php +++ b/module/tutorial/test/lib/tutorial.unittest.class.php @@ -269,4 +269,19 @@ class tutorialTest return $result; } + + /** + * 测试获取新手模式研发需求键值对。 + * Test get tutorial story pairs. + * + * @access public + * @return array + */ + public function getStoryPairsTest(): array + { + $result = $this->objectModel->getStoryPairs(); + if(dao::isError()) return dao::getError(); + + return $result; + } } diff --git a/module/tutorial/test/model/getstoryPairs.php b/module/tutorial/test/model/getstoryPairs.php new file mode 100755 index 0000000000..684e49e69d --- /dev/null +++ b/module/tutorial/test/model/getstoryPairs.php @@ -0,0 +1,34 @@ +#!/usr/bin/env php +getStoryPairsTest(); +r(count($storyPairs)) && p() && e('4'); // 步骤1:验证返回数组包含所有需求键值对 +r($storyPairs) && p('1') && e('Test epic'); // 步骤2:验证Epic需求标题正确 +r($storyPairs) && p('2') && e('Test requirement'); // 步骤3:验证用户需求标题正确 +r($storyPairs) && p('3') && e('Test active story'); // 步骤4:验证研发需求标题正确 +r($storyPairs) && p('4') && e('Test reviewing story'); // 步骤5:验证评审中需求标题正确 \ No newline at end of file