+ [misc] Add unit tests for todoZen::setSessionUri() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1725,4 +1725,37 @@ class todoTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test setSessionUri method.
|
||||
*
|
||||
* @param string $uri URI参数
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function setSessionUriTest(string $uri)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// 确保config->todo->sessionUri配置存在
|
||||
if(!isset($config->todo)) {
|
||||
$config->todo = new stdClass();
|
||||
}
|
||||
if(!isset($config->todo->sessionUri)) {
|
||||
$config->todo->sessionUri = array(
|
||||
'bugList' => 'qa',
|
||||
'todoList' => 'my',
|
||||
'taskList' => 'execution',
|
||||
'storyList' => 'product',
|
||||
'testtaskList' => 'qa'
|
||||
);
|
||||
}
|
||||
|
||||
$method = $this->objectZen->getMethod('setSessionUri');
|
||||
$method->setAccessible(true);
|
||||
$result = $method->invoke($this->todoZen, $uri);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 todoZen::setSessionUri();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 步骤1:设置有效的URI @1
|
||||
- 步骤2:设置空字符串URI @1
|
||||
- 步骤3:设置带参数的URI @1
|
||||
- 步骤4:设置特殊字符URI @1
|
||||
- 步骤5:设置长URI字符串 @1
|
||||
|
||||
*/
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/todozen.unittest.class.php';
|
||||
|
||||
// 2. 用户登录(选择合适角色)
|
||||
su('admin');
|
||||
|
||||
// 3. 创建测试实例(变量名与模块名一致)
|
||||
$todoTest = new todoTest();
|
||||
|
||||
// 4. 🔴 强制要求:必须包含至少5个测试步骤
|
||||
r($todoTest->setSessionUriTest('todo-browse-all-all-all.html')) && p() && e(1); // 步骤1:设置有效的URI
|
||||
r($todoTest->setSessionUriTest('')) && p() && e(1); // 步骤2:设置空字符串URI
|
||||
r($todoTest->setSessionUriTest('todo-browse-all-all-all.html?param=value')) && p() && e(1); // 步骤3:设置带参数的URI
|
||||
r($todoTest->setSessionUriTest('todo-browse-all-all-all.html#anchor')) && p() && e(1); // 步骤4:设置特殊字符URI
|
||||
r($todoTest->setSessionUriTest('very-long-uri-string-with-many-parameters-todo-browse-all-all-all.html?param1=value1¶m2=value2¶m3=value3')) && p() && e(1); // 步骤5:设置长URI字符串
|
||||
Reference in New Issue
Block a user