From 2bc55ba565fd9a42ccb4d26c09c37eddc1ff5207 Mon Sep 17 00:00:00 2001 From: liuchenglong Date: Thu, 11 May 2023 07:28:56 +0000 Subject: [PATCH] + Add programplan-model setTreePath test case. --- module/programplan/test/model/settreepath.php | 31 ++++++++++--------- .../test/model/yaml/settreepath/project.yaml | 24 ++++++++++++++ 2 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 module/programplan/test/model/yaml/settreepath/project.yaml diff --git a/module/programplan/test/model/settreepath.php b/module/programplan/test/model/settreepath.php index ed86df464f..8dde4933fe 100755 --- a/module/programplan/test/model/settreepath.php +++ b/module/programplan/test/model/settreepath.php @@ -1,28 +1,31 @@ #!/usr/bin/env php config('project')->gen(10); +} + /** title=测试 programplanModel->setTreePath(); cid=1 pid=1 -测试更新计划131的路径 >> 阶段31;,41,131, -测试更新计划132的路径 >> 阶段32;,42,132, -测试更新计划133的路径 >> 阶段33;,43,133, -测试更新计划134的路径 >> 阶段34;,44,134, -测试更新计划135的路径 >> 阶段35;,45,135, - */ -$planIDList = array(131, 132, 133, 134, 135); -$programplan = new programplanTest(); +initData(); + +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 -r($programplan->setTreePathTest($planIDList[0])) && p('name;path') && e('阶段31;,41,131,'); // 测试更新计划131的路径 -r($programplan->setTreePathTest($planIDList[1])) && p('name;path') && e('阶段32;,42,132,'); // 测试更新计划132的路径 -r($programplan->setTreePathTest($planIDList[2])) && p('name;path') && e('阶段33;,43,133,'); // 测试更新计划133的路径 -r($programplan->setTreePathTest($planIDList[3])) && p('name;path') && e('阶段34;,44,134,'); // 测试更新计划134的路径 -r($programplan->setTreePathTest($planIDList[4])) && p('name;path') && e('阶段35;,45,135,'); // 测试更新计划135的路径 \ No newline at end of file diff --git a/module/programplan/test/model/yaml/settreepath/project.yaml b/module/programplan/test/model/yaml/settreepath/project.yaml new file mode 100644 index 0000000000..6ed2c04ee9 --- /dev/null +++ b/module/programplan/test/model/yaml/settreepath/project.yaml @@ -0,0 +1,24 @@ +title: zt_project +author: liuchenglong +version: "1.0" +fields: + - field: id + range: 1-20 + - field: project + range: 0, 1, 1, 0, 4, 4, 0, 7, 7, 0 + - field: model + range: 'waterfall, , ,waterfall, , ,waterfall, , , ,' + - field: type + range: 'project,stage,stage,project,stage,stage,project,stage,stage,project,stage,status,stage,stage' + - field: status + range: 'suspended,suspended,wait,suspended,suspended,closed,doing,doing,suspended,wait' + - field: parent + range: 0, 1, 2, 0, 4, 5, 0, 7, 8, 9 + - field: path + range: '`,1,`, ``, `,1,2,3`, `,4,`, `,4,5,`, `,4,5,6,`, `,7,`, `,7,8,`, ``, `,7,8,9,10,`' + - field: hasProduct + range: 1, 1, 1, 1, 1, 0 + - field: name + range: '项目1, 执行1-1, 执行1-1-1, 项目2, 执行2-1, 执行2-1-1, 项目3, 执行3-1, 执行3-1-1' + - field: code + range: 'sprint1, sprint1-1, sprint1-1-1, sprint2, sprint2-1, sprint2-1-1, sprint3, sprint3-1, sprint3-1-1'