From c67332b621cd15625b62a331a29bfb60ff40b9b0 Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 10 Sep 2025 15:44:32 +0800 Subject: [PATCH] + [misc] Add unit tests for tutorialModel::getBug() 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/getbug.php | 29 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 module/tutorial/test/model/getbug.php diff --git a/module/tutorial/test/lib/tutorial.unittest.class.php b/module/tutorial/test/lib/tutorial.unittest.class.php index a4dbc01ed3..71bf7978a7 100644 --- a/module/tutorial/test/lib/tutorial.unittest.class.php +++ b/module/tutorial/test/lib/tutorial.unittest.class.php @@ -631,4 +631,19 @@ class tutorialTest return $result; } + + /** + * 测试获取新手模式Bug。 + * Test get bug. + * + * @access public + * @return object + */ + public function getBugTest(): object + { + $result = $this->objectModel->getBug(); + if(dao::isError()) return dao::getError(); + + return $result; + } } diff --git a/module/tutorial/test/model/getbug.php b/module/tutorial/test/model/getbug.php new file mode 100755 index 0000000000..84c88b6c2d --- /dev/null +++ b/module/tutorial/test/model/getbug.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +getBugTest()) && p('id') && e('1'); // 步骤1:验证Bug对象ID +r($tutorialTest->getBugTest()) && p('title') && e('Test bug-active'); // 步骤2:验证Bug对象标题 +r($tutorialTest->getBugTest()) && p('status') && e('active'); // 步骤3:验证Bug对象状态 +r($tutorialTest->getBugTest()) && p('type') && e('codeerror'); // 步骤4:验证Bug对象类型 +r($tutorialTest->getBugTest()) && p('project') && e('2'); // 步骤5:验证Bug对象项目ID \ No newline at end of file