From 45ef9d356c2864f26b55626528bdb48cb307aaf4 Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 6 Nov 2025 12:46:12 +0800 Subject: [PATCH] + [misc] Add unit tests for actionTao::processCreateChildrenActionExtra() 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 --- .../tao/processcreatechilrenactionextra.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 module/action/test/tao/processcreatechilrenactionextra.php diff --git a/module/action/test/tao/processcreatechilrenactionextra.php b/module/action/test/tao/processcreatechilrenactionextra.php new file mode 100755 index 0000000000..69f1dc1a86 --- /dev/null +++ b/module/action/test/tao/processcreatechilrenactionextra.php @@ -0,0 +1,33 @@ +#!/usr/bin/env php +> 期望返回单个任务信息 +- 测试多个子任务ID >> 期望返回多个任务信息用逗号分隔 +- 测试不存在的任务ID >> 期望返回空字符串 +- 测试空字符串 >> 期望返回空字符串 +- 测试混合存在和不存在的任务ID >> 期望只返回存在的任务信息 + +*/ + +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/action.unittest.class.php'; + +zenData('task')->loadYaml('task_processcreatechilredactionextra', false, 2)->gen(10); +zenData('user')->gen(5); + +su('admin'); + +$actionTest = new actionTest(); + +r($actionTest->processCreateChildrenActionExtraTest('1')) && p('extra') && e('#1 开发任务11'); +r($actionTest->processCreateChildrenActionExtraTest('1,2,3')) && p('extra') && e('#1 开发任务11, #2 开发任务12, #3 开发任务13'); +r($actionTest->processCreateChildrenActionExtraTest('999')) && p('extra') && e('0'); +r($actionTest->processCreateChildrenActionExtraTest('')) && p('extra') && e('0'); +r($actionTest->processCreateChildrenActionExtraTest('1,999,2')) && p('extra') && e('#1 开发任务11, #2 开发任务12');