+ [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:
@@ -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('#');
|
||||
Reference in New Issue
Block a user