diff --git a/module/programplan/test/model/getdataforgantt.php b/module/programplan/test/model/getdataforgantt.php new file mode 100755 index 0000000000..3439159e12 --- /dev/null +++ b/module/programplan/test/model/getdataforgantt.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +config('project')->gen(5); + zdTable('task')->config('task')->gen(8); + zdTable('projectproduct')->config('projectproduct')->gen(5); +} + +/** + +title=测试 programplanModel->getDataForGantt(); +timeout=0 +cid=1 + +*/ + +initData(); +$programplan = new programplanTest(); + +$selectCustom = 'date,task'; +$selectNoneCustom = ''; +r($programplan->getDataForGanttTest(1, 1, 0, $selectCustom, false)) && p('0:type') && e('plan'); // 测试获取阶段数据 +r($programplan->getDataForGanttTest(1, 1, 0, $selectCustom, false)) && p('4:id,type') && e('2-1,task'); // 测试获取任务数据 +r($programplan->getDataForGanttTest(1, 1, 0, $selectCustom, true)) && p('0:type') && e('plan'); // 测试获取阶段数据(JSON类型返回值) +r($programplan->getDataForGanttTest(1, 1, 0, $selectCustom, true)) && p('4:id,type') && e('2-1,task'); // 测试获取任务数据(JSON类型返回值) +r(count($programplan->getDataForGanttTest(1, 1, 0, $selectNoneCustom, false))) && p() && e('4'); // 测试自定义参数为空的情况获取任务数据 diff --git a/module/programplan/test/model/yaml/getdataforgantt/project.yaml b/module/programplan/test/model/yaml/getdataforgantt/project.yaml new file mode 100644 index 0000000000..2a153eab70 --- /dev/null +++ b/module/programplan/test/model/yaml/getdataforgantt/project.yaml @@ -0,0 +1,91 @@ +title: table zt_project +desc: '项目、执行' +author: lanzongjun +version: '1.0' +fields: + - field: id + range: 1-10 + - field: project + range: 1 + - field: model + range: waterfall,[]{9} + - field: name + note: "名称" + fields: + - field: name1 + range: 项目,执行{9} + - field: name2 + range: 1,[1-9] + - field: type + range: project,stage{4},scrum{3},kanban{2} + - field: status + range: wait{2},doing{4},suspended,closed + - field: lifetime + range: + - field: budget + range: 900000-1:100 + - field: budgetUnit + range: CNY,USD + - field: attribute + note: "Only stage has attribute" + range: + - field: percent + range: 1-100:R + - field: milestone + note: "Is it milestone" + range: 0 + - field: output + note: "Output document" + range: + - field: auth + note: "Only project has auth" + range: "extend" + - field: parent + range: 1-10 + - field: path + fields: + - field: path1 + prefix: "," + range: 1 + - field: path2 + prefix: "," + range: 2-10 + postfix: "," + - field: grade + range: "2" + - field: code + range: 1-10000 + prefix: "project" + - field: begin + range: "(-3M)-(+M):1D" + type: timestamp + format: "YY/MM/DD" + postfix: "\t" + - field: end + range: "(+5w)-(+2M):1D" + type: timestamp + format: "YY/MM/DD" + postfix: "\t" + - field: PO + range: + - field: PM + range: + - field: QD + range: + - field: RD + range: + - field: team + range: + - field: acl + range: open,private,program + - field: order + range: 5-10000:5 + - field: openedVersion + range: + - field: openedDate + range: "(-3M)-(+M):1D" + type: timestamp + format: "YY/MM/DD" + postfix: "\t" + - field: deleted + range: 0 diff --git a/module/programplan/test/model/yaml/getdataforgantt/projectproduct.yaml b/module/programplan/test/model/yaml/getdataforgantt/projectproduct.yaml new file mode 100644 index 0000000000..bed5f3203c --- /dev/null +++ b/module/programplan/test/model/yaml/getdataforgantt/projectproduct.yaml @@ -0,0 +1,8 @@ +title: zt_projectproduct +author: lanzongjun +version: '1.0' +fields: + - field: project + range: 1, 2, 3, 4, 5 + - field: product + range: 1{5} diff --git a/module/programplan/test/model/yaml/getdataforgantt/task.yaml b/module/programplan/test/model/yaml/getdataforgantt/task.yaml new file mode 100644 index 0000000000..fc49aa6200 --- /dev/null +++ b/module/programplan/test/model/yaml/getdataforgantt/task.yaml @@ -0,0 +1,22 @@ +title: zt_task +author: lanzongjun +version: '1.0' +fields: + - field: id + range: 1-8 + - field: project + range: 1 + - field: execution + range: 2{2},3{2},4{2},5{2} + - field: type + range: design,devel,test,study,discuss,ui,affair,misc + - field: status + range: wait{8} + - field: deleted + range: 0,1,1,0 + - field: vision + range: rnd,rnd,rnd,lite + - field: openedDate + range: "20220101 000000:1W" # 生成从2021年1月1日0时0分0秒到当前时间的数据,步长为1周 + type: timestamp + format: "YY/MM/DD hh:mm:ss" diff --git a/module/programplan/test/programplan.class.php b/module/programplan/test/programplan.class.php index 7313a3e120..3e63d514bf 100644 --- a/module/programplan/test/programplan.class.php +++ b/module/programplan/test/programplan.class.php @@ -489,4 +489,25 @@ class programplanTest { return $this->objectModel->printCell($col, $plan, $users, $projectID); } + + /** + * 测试获取甘特图相关数据。 + * Test get data for gantt view. + * + * @param int $executionID + * @param int $productID + * @param int $baselineID + * @param string $selectCustom + * @param bool $returnJson + * @access public + * @return array + */ + public function getDataForGanttTest(int $executionID, int $productID, int $baselineID = 0, string $selectCustom = '', bool $returnJson = true) + { + $objects = $this->objectModel->getDataForGantt($executionID, $productID, $baselineID, $selectCustom, $returnJson); + + if($returnJson) $objects = json_decode($objects, true); + + return $objects['data']; + } }