* [misc] Enhance unit tests for programplanModel::setTreePath() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,27 +3,48 @@
|
||||
|
||||
/**
|
||||
|
||||
title=测试 programplanModel->setTreePath();
|
||||
title=测试 programplanModel::setTreePath();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 给stageID=2没有子阶段不走if设置path,grade
|
||||
- 执行programplanTest模块的setTreePathTest方法,参数是2
|
||||
- 属性path @,1,2,
|
||||
- 属性grade @ 1
|
||||
- 给stageID=9有子阶段走if设置path,grade
|
||||
- 属性path @,7,8,9,
|
||||
- 属性grade @ 3
|
||||
- 属性grade @1
|
||||
- 执行programplanTest模块的setTreePathTest方法,参数是3
|
||||
- 属性path @,1,2,3,
|
||||
- 属性grade @2
|
||||
- 执行programplanTest模块的setTreePathTest方法,参数是7
|
||||
- 属性path @,7,
|
||||
- 属性grade @1
|
||||
- 执行programplanTest模块的setTreePathTest方法,参数是8
|
||||
- 属性path @,7,8,
|
||||
- 属性grade @1
|
||||
- 执行programplanTest模块的setTreePathTest方法,参数是1
|
||||
- 属性path @,1,
|
||||
- 属性grade @1
|
||||
- 执行programplanTest模块的setTreePathTest方法,参数是6
|
||||
- 属性path @,4,5,6,
|
||||
- 属性grade @3
|
||||
- 执行$result @1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
su('admin');
|
||||
include dirname(__FILE__, 2) . '/lib/programplan.unittest.class.php';
|
||||
|
||||
zenData('project')->loadYaml('project')->gen(10);
|
||||
|
||||
su('admin');
|
||||
|
||||
$programplanTest = new programplanTest();
|
||||
|
||||
r($programplanTest->setTreePathTest(2)) && p('path|grade', '|') && e(',1,2,|1');
|
||||
r($programplanTest->setTreePathTest(3)) && p('path|grade', '|') && e(',1,2,3,|2');
|
||||
r($programplanTest->setTreePathTest(7)) && p('path|grade', '|') && e(',7,|1');
|
||||
r($programplanTest->setTreePathTest(8)) && p('path|grade', '|') && e(',7,8,|1');
|
||||
r($programplanTest->setTreePathTest(1)) && p('path|grade', '|') && e(',1,|1');
|
||||
r($programplanTest->setTreePathTest(6)) && p('path|grade', '|') && e(',4,5,6,|3');
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('programplan');
|
||||
|
||||
$tester->programplan->setTreePath(2);
|
||||
$tester->programplan->setTreePath(9);
|
||||
|
||||
r($tester->programplan->getByID(2)) && p('path|grade', '|') && e(',1,2,| 1'); // 给stageID=2没有子阶段不走if设置path,grade
|
||||
r($tester->programplan->getByID(9)) && p('path|grade', '|') && e(',7,8,9,| 3'); // 给stageID=9有子阶段走if设置path,grade
|
||||
$result = $tester->programplan->setTreePath(9);
|
||||
r($result) && p() && e(1);
|
||||
Reference in New Issue
Block a user