From 259daeecf719751081d23149fde4d1b81ce8f2b7 Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 24 Nov 2025 20:10:55 +0800 Subject: [PATCH] + [misc] Add unit tests for actionTao::processLinkStoryAndBugActionExtra() 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 --- module/action/test/lib/tao.class.php | 34 +++++++++++++++++++ .../tao/processlinkstoryandbugactionextra.php | 31 +++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 module/action/test/lib/tao.class.php create mode 100755 module/action/test/tao/processlinkstoryandbugactionextra.php diff --git a/module/action/test/lib/tao.class.php b/module/action/test/lib/tao.class.php new file mode 100644 index 0000000000..ed18feb863 --- /dev/null +++ b/module/action/test/lib/tao.class.php @@ -0,0 +1,34 @@ +objectModel = $tester->loadModel('action'); + $this->objectTao = $tester->loadTao('action'); + } + + /** + * Test processLinkStoryAndBugActionExtra method. + * + * @param string $ids + * @param string $module + * @param string $method + * @access public + * @return object + */ + public function processLinkStoryAndBugActionExtraTest(string $ids, string $module = 'story', string $method = 'view'): object + { + $action = new stdClass(); + $action->extra = $ids; + + $this->objectTao->processLinkStoryAndBugActionExtra($action, $module, $method); + if(dao::isError()) return dao::getError(); + return $action; + } +} diff --git a/module/action/test/tao/processlinkstoryandbugactionextra.php b/module/action/test/tao/processlinkstoryandbugactionextra.php new file mode 100755 index 0000000000..bd526ca2f0 --- /dev/null +++ b/module/action/test/tao/processlinkstoryandbugactionextra.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +processLinkStoryAndBugActionExtraTest('1', 'story', 'view')) && p('extra') && e('#1'); +r($actionTest->processLinkStoryAndBugActionExtraTest('1,2,3', 'story', 'view')) && p('extra') && e('#1, #2, #3'); +r($actionTest->processLinkStoryAndBugActionExtraTest('100', 'bug', 'view')) && p('extra') && e('#100'); +r($actionTest->processLinkStoryAndBugActionExtraTest('100,101,102,103', 'bug', 'view')) && p('extra') && e('#100, #101, #102, #103'); +r($actionTest->processLinkStoryAndBugActionExtraTest('', 'story', 'view')) && p('extra') && e('#'); \ No newline at end of file