From 98739864144c2c40aa14a9e43044ed22da2e83f7 Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 10 Sep 2025 20:27:39 +0800 Subject: [PATCH] + [misc] Add unit tests for tutorialModel::getCharters() 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 | 14 ++++++++ module/tutorial/test/model/getcharters.php | 33 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 module/tutorial/test/model/getcharters.php diff --git a/module/tutorial/test/lib/tutorial.unittest.class.php b/module/tutorial/test/lib/tutorial.unittest.class.php index 544fa1534a..6e0b24118a 100644 --- a/module/tutorial/test/lib/tutorial.unittest.class.php +++ b/module/tutorial/test/lib/tutorial.unittest.class.php @@ -1292,4 +1292,18 @@ class tutorialTest return $result; } + + /** + * Test getCharters method. + * + * @access public + * @return array + */ + public function getChartersTest(): array + { + $result = $this->objectModel->getCharters(); + if(dao::isError()) return dao::getError(); + + return $result; + } } diff --git a/module/tutorial/test/model/getcharters.php b/module/tutorial/test/model/getcharters.php new file mode 100755 index 0000000000..686eb2005c --- /dev/null +++ b/module/tutorial/test/model/getcharters.php @@ -0,0 +1,33 @@ +#!/usr/bin/env php +getChartersTest())) && p() && e('1'); // 步骤1:正常调用返回数组长度为1 +r($tutorialTest->getChartersTest()) && p('1:id') && e('1'); // 步骤2:验证charter对象ID为1 +r($tutorialTest->getChartersTest()) && p('1:name') && e('Test charter'); // 步骤3:验证charter对象名称 +r($tutorialTest->getChartersTest()) && p('1:status') && e('wait'); // 步骤4:验证charter对象状态 +r($tutorialTest->getChartersTest()) && p('1:level') && e('3'); // 步骤5:验证charter对象级别 \ No newline at end of file