* [misc] Enhance unit tests for programplanModel::checkLeafStage() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -823,4 +823,20 @@ class programplanTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test checkLeafStage method.
|
||||
*
|
||||
* @param int $stageID
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkLeafStageTest(int $stageID): bool
|
||||
{
|
||||
$result = $this->objectModel->checkLeafStage($stageID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,23 +3,27 @@
|
||||
|
||||
/**
|
||||
|
||||
title=测试programplanModel->checkLeafStage();
|
||||
title=测试 programplanModel::checkLeafStage();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 获取阶段ID为0,判断是是否为叶子节点,结果为0 @0
|
||||
- 获取阶段ID为2,判断是是否为叶子节点,结果为0 @0
|
||||
- 获取阶段ID为5,判断是否为叶子节点,结果为1 @1
|
||||
- 测试步骤1:正常输入有效阶段ID,测试叶子节点判断逻辑 @1
|
||||
- 测试步骤2:正常输入有效阶段ID,测试叶子节点判断逻辑 @1
|
||||
- 测试步骤3:边界值测试,输入0,空ID应返回false @0
|
||||
- 测试步骤4:异常输入测试,输入负数ID,负数ID处理逻辑 @1
|
||||
- 测试步骤5:异常输入测试,输入不存在的极大ID,不存在ID处理逻辑 @1
|
||||
|
||||
*/
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/programplan.unittest.class.php';
|
||||
su('admin');
|
||||
|
||||
zenData('project')->loadYaml('checkleafstage')->gen(5);
|
||||
zenData('project')->loadYaml('checkleafstage/checkleafstage')->gen(10);
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('programplan');
|
||||
$programplanTest = new programplanTest();
|
||||
|
||||
r($tester->programplan->checkLeafStage($stageID = 0)) && p('') && e('0'); // 获取阶段ID为0,判断是是否为叶子节点,结果为0
|
||||
r($tester->programplan->checkLeafStage($stageID = 2)) && p('') && e('0'); // 获取阶段ID为2,判断是是否为叶子节点,结果为0
|
||||
r($tester->programplan->checkLeafStage($stageID = 5)) && p('') && e('1'); // 获取阶段ID为5,判断是否为叶子节点,结果为1
|
||||
r($programplanTest->checkLeafStageTest(1)) && p() && e('1'); // 测试步骤1:正常输入有效阶段ID,测试叶子节点判断逻辑
|
||||
r($programplanTest->checkLeafStageTest(4)) && p() && e('1'); // 测试步骤2:正常输入有效阶段ID,测试叶子节点判断逻辑
|
||||
r($programplanTest->checkLeafStageTest(0)) && p() && e('0'); // 测试步骤3:边界值测试,输入0,空ID应返回false
|
||||
r($programplanTest->checkLeafStageTest(-1)) && p() && e('1'); // 测试步骤4:异常输入测试,输入负数ID,负数ID处理逻辑
|
||||
r($programplanTest->checkLeafStageTest(999999)) && p() && e('1'); // 测试步骤5:异常输入测试,输入不存在的极大ID,不存在ID处理逻辑
|
||||
Reference in New Issue
Block a user