+ [misc] Add unit tests for branchZen::setParamsForLink() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ class branchTest
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('branch');
|
||||
$this->objectZen = $tester->loadZen('branch');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -476,4 +477,23 @@ class branchTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test setParamsForLink method.
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $link
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function setParamsForLinkTest(string $module, string $link, int $projectID, int $productID): string
|
||||
{
|
||||
$result = $this->objectZen->setParamsForLink($module, $link, $projectID, $productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 branchZen::setParamsForLink();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, ['plan', '/test-%d-%d-%s', 1, 2] @/test-1-2-{id}
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, ['program', '/test-%d-%d-%s', 1, 2] @/test-1-2-{id}
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, ['project', '/test-%d-%s', 1, 2] @/test-2-{id}
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, ['', '/test-%d-%d-%s', 1, 2] @/test-1-2-{id}
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, ['story', '/test-%d-%s', 1, 2] @/test-2-{id}
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
$zen = initReference('branch');
|
||||
$func = $zen->getMethod('setParamsForLink');
|
||||
|
||||
r($func->invokeArgs($zen->newInstance(), ['plan', '/test-%d-%d-%s', 1, 2])) && p() && e('/test-1-2-{id}');
|
||||
r($func->invokeArgs($zen->newInstance(), ['program', '/test-%d-%d-%s', 1, 2])) && p() && e('/test-1-2-{id}');
|
||||
r($func->invokeArgs($zen->newInstance(), ['project', '/test-%d-%s', 1, 2])) && p() && e('/test-2-{id}');
|
||||
r($func->invokeArgs($zen->newInstance(), ['', '/test-%d-%d-%s', 1, 2])) && p() && e('/test-1-2-{id}');
|
||||
r($func->invokeArgs($zen->newInstance(), ['story', '/test-%d-%s', 1, 2])) && p() && e('/test-2-{id}');
|
||||
Reference in New Issue
Block a user