+ [misc] Add unit tests for actionTao::processLinkStoryAndBugActionExtra() method

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-09-15 15:09:40 +08:00
co-authored by Claude
parent 311473f5eb
commit 535fc121fe
2 changed files with 57 additions and 0 deletions
@@ -1338,4 +1338,28 @@ class actionTest
return $action;
}
/**
* Test processLinkStoryAndBugActionExtra method.
*
* @param string $extra
* @param string $module
* @param string $method
* @access public
* @return object
*/
public function processLinkStoryAndBugActionExtraTest(string $extra, string $module, string $method): object
{
global $tester;
$actionTao = $tester->loadTao('action');
$action = new stdClass();
$action->extra = $extra;
$actionTao->processLinkStoryAndBugActionExtra($action, $module, $method);
if(dao::isError()) return dao::getError();
return $action;
}
}
@@ -0,0 +1,33 @@
#!/usr/bin/env php
<?php
/**
title=测试 actionTao::processLinkStoryAndBugActionExtra();
timeout=0
cid=0
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'1', 'story', 'view' 属性extra @~~
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'1, 2', 'bug', 'view' 属性extra @~~
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'3', 'task', 'view' 属性extra @~~
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'', 'story', 'view' 属性extra @~~
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'1, 2, 3', 'story', 'view' 属性extra @~~
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
zenData('story')->gen(10);
zenData('bug')->gen(10);
zenData('task')->gen(10);
su('admin');
$actionTest = new actionTest();
r($actionTest->processLinkStoryAndBugActionExtraTest('1', 'story', 'view')) && p('extra') && e('~~');
r($actionTest->processLinkStoryAndBugActionExtraTest('1,2', 'bug', 'view')) && p('extra') && e('~~');
r($actionTest->processLinkStoryAndBugActionExtraTest('3', 'task', 'view')) && p('extra') && e('~~');
r($actionTest->processLinkStoryAndBugActionExtraTest('', 'story', 'view')) && p('extra') && e('~~');
r($actionTest->processLinkStoryAndBugActionExtraTest('1,2,3', 'story', 'view')) && p('extra') && e('~~');