From d6fddf8eb898ca226f810f483adf185699fa560c Mon Sep 17 00:00:00 2001 From: jukui Date: Thu, 11 May 2023 13:12:44 +0800 Subject: [PATCH] * Modify test case of getByList function. --- module/programplan/test/model/getbylist.php | 25 ++++++++--------- .../test/model/yaml/getbylist/project.yaml | 27 +++++++++++++++++++ .../model/yaml/getbylist/projectduct.yaml | 12 +++++++++ .../test/tao/yaml/getstagelistby/project.yaml | 4 +-- 4 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 module/programplan/test/model/yaml/getbylist/project.yaml create mode 100644 module/programplan/test/model/yaml/getbylist/projectduct.yaml diff --git a/module/programplan/test/model/getbylist.php b/module/programplan/test/model/getbylist.php index b81c5a2ced..65e3f518e9 100755 --- a/module/programplan/test/model/getbylist.php +++ b/module/programplan/test/model/getbylist.php @@ -4,26 +4,27 @@ include dirname(__FILE__, 5) . '/test/lib/init.php'; include dirname(__FILE__, 2) . '/programplan.class.php'; su('admin'); +zdTable('project')->config('project')->gen(8); /** title=测试 programplanModel->getByList(); cid=1 pid=1 -测试获取项目11 12的信息 >> 项目1;项目2 -测试获取项目13 14的信息 >> 项目3;项目4 -测试获取项目15 16 17的信息 >> 项目5;项目6;项目7 -测试获取项目18 19 20的信息 >> 项目8;项目9;项目10 -测试获取项目21 22 23 24的信息 >> 项目11;项目12;项目13;项目14 - */ -$planIDList = array(array(11, 12), array(13, 14), array(15, 16, 17), array(18, 19, 20), array(21, 22, 23, 24)); +$planIDList = array(array(2), array(3, 4), array(5, 6, 7), array(10000)); $programplan = new programplanTest(); -r($programplan->getByListTest($planIDList[0])) && p('11:name;12:name') && e('项目1;项目2'); // 测试获取项目11 12的信息 -r($programplan->getByListTest($planIDList[1])) && p('13:name;14:name') && e('项目3;项目4'); // 测试获取项目13 14的信息 -r($programplan->getByListTest($planIDList[2])) && p('15:name;16:name;17:name') && e('项目5;项目6;项目7'); // 测试获取项目15 16 17的信息 -r($programplan->getByListTest($planIDList[3])) && p('18:name;19:name;20:name') && e('项目8;项目9;项目10'); // 测试获取项目18 19 20的信息 -r($programplan->getByListTest($planIDList[4])) && p('21:name;22:name;23:name;24:name') && e('项目11;项目12;项目13;项目14'); // 测试获取项目21 22 23 24的信息 \ No newline at end of file +r($programplan->getByListTest($planIDList[0])) && p('2:name') && e('瀑布项目2'); // 测试获取项目2的名称 +r($programplan->getByListTest($planIDList[0])) && p('2:status') && e('doing'); // 测试获取项目2的状态 + +$result = $programplan->getByListTest($planIDList[1]); +r(count($result)) && p() && e('2'); // 测试获取项目3 4的取出的数量 + +$result = $programplan->getByListTest($planIDList[2]); +r($result[5]) && p('name,desc') && e('瀑布项目5,项目描述5'); // 测试获取项目5的名称和描述信息 +r(count($result)) && p() && e('3'); // 测试获取5 6 7 项目数量 + +r($programplan->getByListTest($planIDList[3])) && p() && e('0'); // 测试获取不存在的项目信息 diff --git a/module/programplan/test/model/yaml/getbylist/project.yaml b/module/programplan/test/model/yaml/getbylist/project.yaml new file mode 100644 index 0000000000..51288f923d --- /dev/null +++ b/module/programplan/test/model/yaml/getbylist/project.yaml @@ -0,0 +1,27 @@ +title: zt_project +author: jukui +version: '1.0' +fields: + - field: id + range: 1-10 + - field: project + range: '0,1,2,3,1,2,2,1,5,5' + - field: name + range: 1-10 + prefix: '瀑布项目' + - field: parent + range: '0' + - field: type + range: 'project' + - field: percent + range: 1-9 + prefix: '2' + - field: grade + range: 1 + - field: days + range: 1 + - field: status + range: 'doing,doing,doing,closed,suspended,closed' + - field: desc + range: 1-10 + prefix: '项目描述' diff --git a/module/programplan/test/model/yaml/getbylist/projectduct.yaml b/module/programplan/test/model/yaml/getbylist/projectduct.yaml new file mode 100644 index 0000000000..16b10dbb0d --- /dev/null +++ b/module/programplan/test/model/yaml/getbylist/projectduct.yaml @@ -0,0 +1,12 @@ +title: zt_projectproduct +author: jukui +version: '1.0' +fields: + - field: project + range: 1-10 + - field: product + range: '2' + - field: branch + range: 0 + - field: plan + range: 0 diff --git a/module/programplan/test/tao/yaml/getstagelistby/project.yaml b/module/programplan/test/tao/yaml/getstagelistby/project.yaml index 315d6edc2a..c42a607273 100644 --- a/module/programplan/test/tao/yaml/getstagelistby/project.yaml +++ b/module/programplan/test/tao/yaml/getstagelistby/project.yaml @@ -5,13 +5,13 @@ fields: - field: id range: 1-6 - field: project - range: '1,2,3,4,1,1' + range: '0,1,2,3,1,1' - field: name range: '瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b,阶段c' - field: parent range: '0,1,2,3,1,1' - field: type - range: 'stage' + range: 'project,stage{9}' - field: percent range: 1-6 prefix: '2'