+ [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-11-25 08:37:58 +08:00
co-authored by Claude
parent 17316c84a0
commit 259daeecf7
2 changed files with 65 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
declare(strict_types = 1);
class actionTaoTest
{
public $objectModel;
public $objectTao;
public function __construct()
{
global $tester;
$this->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;
}
}
@@ -0,0 +1,31 @@
#!/usr/bin/env php
<?php
/**
title=- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'1'属性extra @
timeout=0
cid=1
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'1', 'story', 'view' 属性extra @#1
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'1, 2, 3', 'story', 'view'
- 属性extra @#1
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'100', 'bug', 'view' 属性extra @#100
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'100, 101, 102, 103', 'bug', 'view'
- 属性extra @#100
- 执行actionTest模块的processLinkStoryAndBugActionExtraTest方法,参数是'', 'story', 'view' 属性extra @#
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/tao.class.php';
su('admin');
$actionTest = new actionTaoTest();
r($actionTest->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('#');