From 57ee9c9c430c425bcace5bb469cef5fe703c744d Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 29 Aug 2023 16:46:44 +0800 Subject: [PATCH] * Add case of the buildExecutionCards method. --- module/kanban/test/kanban.class.php | 26 ++++++++++ .../kanban/test/model/buildexecutioncards.php | 36 +++++++++++++ module/kanban/test/yaml/kanban.yaml | 14 +++++ module/kanban/test/yaml/kanbancard.yaml | 13 +++++ module/kanban/test/yaml/kanbancell.yaml | 22 ++++++++ module/kanban/test/yaml/kanbangroup.yaml | 9 ++++ module/kanban/test/yaml/kanbanlane.yaml | 27 ++++++++++ module/kanban/test/yaml/kanbanregion.yaml | 26 ++++++++++ module/kanban/test/yaml/project.yaml | 24 +++++++++ module/kanban/test/yaml/task.yaml | 52 +++++++++++++++++++ 10 files changed, 249 insertions(+) create mode 100644 module/kanban/test/model/buildexecutioncards.php create mode 100644 module/kanban/test/yaml/kanban.yaml create mode 100644 module/kanban/test/yaml/kanbancard.yaml create mode 100755 module/kanban/test/yaml/kanbancell.yaml create mode 100644 module/kanban/test/yaml/kanbangroup.yaml create mode 100755 module/kanban/test/yaml/kanbanlane.yaml create mode 100644 module/kanban/test/yaml/kanbanregion.yaml create mode 100755 module/kanban/test/yaml/project.yaml create mode 100755 module/kanban/test/yaml/task.yaml diff --git a/module/kanban/test/kanban.class.php b/module/kanban/test/kanban.class.php index d6080bb41f..c2f6c790aa 100644 --- a/module/kanban/test/kanban.class.php +++ b/module/kanban/test/kanban.class.php @@ -1794,4 +1794,30 @@ class kanbanTest $object->object = !empty($object->object) ? $object->object : 0; return $object; } + + /** + * 构建迭代看板的卡片数据。 + * Build the card data for the execution Kanban. + * + * @param int $executionID + * @param int $laneID + * @param string $columnType + * @param array $cardIdList + * @access public + * @return array + */ + public function buildExecutionCardsTest(int $executionID, int $laneID, string $columnType, array $cardIdList): array + { + $lane = $this->objectModel->getLaneById($laneID); + + $objectGroup['story'] = $this->objectModel->loadModel('story')->getExecutionStories($executionID, 0, 't1.`order`_desc', 'allStory'); + $objectGroup['bug'] = $this->objectModel->loadModel('bug')->getExecutionBugs($executionID); + $objectGroup['task'] = $this->objectModel->loadModel('execution')->getKanbanTasks($executionID, "id"); + + $storyCardMenu = $this->objectModel->getKanbanCardMenu($executionID, $objectGroup['story'], 'story'); + $bugCardMenu = $this->objectModel->getKanbanCardMenu($executionID, $objectGroup['bug'], 'bug'); + $taskCardMenu = $this->objectModel->getKanbanCardMenu($executionID, $objectGroup['task'], 'task'); + + return $this->objectModel->buildExecutionCards($lane, array(), $columnType, $cardIdList, $objectGroup, '', $storyCardMenu, $bugCardMenu, $taskCardMenu); + } } diff --git a/module/kanban/test/model/buildexecutioncards.php b/module/kanban/test/model/buildexecutioncards.php new file mode 100644 index 0000000000..4d40839a0a --- /dev/null +++ b/module/kanban/test/model/buildexecutioncards.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +config('project')->gen(5); +zdTable('story')->gen(10); +zdTable('bug')->gen(10); +zdTable('task')->config('task')->gen(10); +zdTable('kanbanlane')->config('kanbanlane')->gen(10); +zdTable('kanbancell')->config('kanbancell')->gen(30); + +/** + +title=测试 kanbanModel->buildExecutionCards(); +timeout=0 +cid=1 + +*/ + +$executionIdList = array(1, 2, 3); +$laneIdList = array(1, 2, 3, 4, 5, 6, 7, 8 ,9); +$columnTypeList = array('task', 'story', 'bug'); +$cardIdList = array(1, 2, 3, 4, 5); + +$kanbanTester = new kanbanTest(); +r($kanbanTester->buildExecutionCardsTest($executionIdList[0], $laneIdList[0], $columnTypeList[0], $cardIdList)) && p('cards:task:0') && e('~~'); // 构造迭代的任务卡片 +r($kanbanTester->buildExecutionCardsTest($executionIdList[1], $laneIdList[1], $columnTypeList[0], $cardIdList)) && p('cards:task:0') && e('N/A'); // 构造阶段的任务卡片 +r($kanbanTester->buildExecutionCardsTest($executionIdList[2], $laneIdList[2], $columnTypeList[0], $cardIdList)) && p('cards:task:0') && e('N/A'); // 构造看板的任务卡片 +r($kanbanTester->buildExecutionCardsTest($executionIdList[0], $laneIdList[3], $columnTypeList[1], $cardIdList)) && p('cards:story:0') && e('N/A'); // 构造迭代的需求卡片 +r($kanbanTester->buildExecutionCardsTest($executionIdList[1], $laneIdList[4], $columnTypeList[1], $cardIdList)) && p('cards:story:0') && e('N/A'); // 构造阶段的需求卡片 +r($kanbanTester->buildExecutionCardsTest($executionIdList[2], $laneIdList[5], $columnTypeList[1], $cardIdList)) && p('cards:story:0') && e('N/A'); // 构造看板的需求卡片 +r($kanbanTester->buildExecutionCardsTest($executionIdList[0], $laneIdList[6], $columnTypeList[2], $cardIdList)) && p('cards:bug:0') && e('N/A'); // 构造迭代的Bug卡片 +r($kanbanTester->buildExecutionCardsTest($executionIdList[1], $laneIdList[7], $columnTypeList[2], $cardIdList)) && p('cards:bug:0') && e('N/A'); // 构造阶段的Bug卡片 +r($kanbanTester->buildExecutionCardsTest($executionIdList[2], $laneIdList[8], $columnTypeList[2], $cardIdList)) && p('cards:bug:0') && e('N/A'); // 构造看板的Bug卡片 diff --git a/module/kanban/test/yaml/kanban.yaml b/module/kanban/test/yaml/kanban.yaml new file mode 100644 index 0000000000..05ec459ec3 --- /dev/null +++ b/module/kanban/test/yaml/kanban.yaml @@ -0,0 +1,14 @@ +title: table zt_kanban +desc: "看板" +author: Tian Shujie +version: "1.0" +fields: + - field: id + range: 1-100 + - field: space + range: 4-100 + - field: name + prefix: 看板 + range: 1-100 + - field: acl + range: open,private,extend diff --git a/module/kanban/test/yaml/kanbancard.yaml b/module/kanban/test/yaml/kanbancard.yaml new file mode 100644 index 0000000000..b9addd50d1 --- /dev/null +++ b/module/kanban/test/yaml/kanbancard.yaml @@ -0,0 +1,13 @@ +title: table zt_kanbancard +desc: 看板卡片 +author: Tian Shujie +version: "1.0" +fields: + - field: id + range: 1-100 + - field: kanban + range: 1-30{8} + - field: region + range: 4-100{8} + - field: group + range: 4-100{8} diff --git a/module/kanban/test/yaml/kanbancell.yaml b/module/kanban/test/yaml/kanbancell.yaml new file mode 100755 index 0000000000..afefa82f68 --- /dev/null +++ b/module/kanban/test/yaml/kanbancell.yaml @@ -0,0 +1,22 @@ +title: table zt_kanbancell +desc: "看板单元格" +author: Tian Shujie +version: "1.0" +fields: + - field: kanban + range: 2{6},3{6},4{6},1-10{4} + - field: lane + range: 1{5},2{3},3{2},4{7},5{3},7{3},8{2},9{5},10-100{4} + - field: column + range: 1,3-6,10-12,17-18,22,23,25,26,28-32,34,50,52-53,63-64,74-75,78-80,82-100 + - field: type + range: task{10},bug{10},story{10},common{30} + - field: cards + fields: + - field: card1 + prefix: "," + postfix: "," + range: 1-20:2{3!},1-40:2 + - field: card2 + postfix: "," + range: 2-20:2{3!},2-40:2 diff --git a/module/kanban/test/yaml/kanbangroup.yaml b/module/kanban/test/yaml/kanbangroup.yaml new file mode 100644 index 0000000000..a72a9fe365 --- /dev/null +++ b/module/kanban/test/yaml/kanbangroup.yaml @@ -0,0 +1,9 @@ +title: table zt_kanbangroup +desc: "看板单元格" +author: Tian Shujie +version: "1.0" +fields: + - field: kanban + range: 2-4,1-100 + - field: region + range: 1-100 diff --git a/module/kanban/test/yaml/kanbanlane.yaml b/module/kanban/test/yaml/kanbanlane.yaml new file mode 100755 index 0000000000..20fe0e6ff5 --- /dev/null +++ b/module/kanban/test/yaml/kanbanlane.yaml @@ -0,0 +1,27 @@ +title: table zt_kanbanlane +desc: "看板泳道" +author: Tian Shujie +version: "1.0" +fields: + - field: id + range: 1-20 + - field: execution + range: "2-4{3!},0{11}" + - field: name + prefix: 泳道 + range: 1-10 + - field: region + range: 1-3{3!},4-20 + - field: type + range: "task{3},story{3},bug{3},common{11}" + - field: group + range: 1-10 + - field: color + range: "#333" + - field: lastEditedTime + range: "20220101 000000:1D" + type: timestamp + format: "YY/MM/DD hh::mm:ss" + postfix: "\t" + - field: deleted + range: "0" diff --git a/module/kanban/test/yaml/kanbanregion.yaml b/module/kanban/test/yaml/kanbanregion.yaml new file mode 100644 index 0000000000..19f4404425 --- /dev/null +++ b/module/kanban/test/yaml/kanbanregion.yaml @@ -0,0 +1,26 @@ +title: table zt_kanbanregion +desc: 看板区域 +author: Tian Shujie +version: "1.0" +fields: + - field: id + range: 1-100 + - field: kanban + range: 2,3,4,1-96 + - field: space + range: "0{3},1-10{10}" + - field: name + range: 1-100 + prefix: 区域 + - field: createdBy + range: "admin,user1,user2,user3,user4,user5" + - field: createdDate + range: "20201101 000000:1D" + type: timestamp + format: "YY/MM/DD hh::mm:ss" + postfix: "\t" + - field: lastEditedDate + range: "20220101 000000:1D" + type: timestamp + format: "YY/MM/DD" + postfix: "\t" diff --git a/module/kanban/test/yaml/project.yaml b/module/kanban/test/yaml/project.yaml new file mode 100755 index 0000000000..d69a6c7e6c --- /dev/null +++ b/module/kanban/test/yaml/project.yaml @@ -0,0 +1,24 @@ +title: table zt_project +author: Hu Fangzhou +version: "1.0" +fields: + - field: id + range: 1-100 + - field: name + range: 项目,迭代,阶段,看板{2} + - field: project + range: 0{1},1{4} + - field: type + range: project,sprint,stage,kanban{2} + - field: vision + range: rnd{4},lite + - field: begin + range: "20201101 000000:1D" + type: timestamp + format: "YY/MM/DD hh::mm:ss" + postfix: "\t" + - field: end + range: "20220101 000000:1D" + type: timestamp + format: "YY/MM/DD" + postfix: "\t" diff --git a/module/kanban/test/yaml/task.yaml b/module/kanban/test/yaml/task.yaml new file mode 100755 index 0000000000..062032c51b --- /dev/null +++ b/module/kanban/test/yaml/task.yaml @@ -0,0 +1,52 @@ +title: zt_task +author: Mengyi Liu +version: "1.0" +fields: + - field: id + range: 1-100 + - field: project + range: 1 + - field: execution + range: 3 + - field: module + range: 0{3},1{3},2{3},3{3} + - field: story + range: 1,0{9} + - field: consumed + range: 0,2{4},0{3},3 + - field: parent + range: "0{5},`-1`,6,0{2}" + - field: status + range: "wait,doing,done,cancel,closed,wait{3},doing" + - field: mode + range: "[]{7},linear,multi" + - field: deleted + range: 0{9},1{3} + - field: assignedTo + range: "[],admin{2},[]{3}" + - field: mailto + fields: + - field: mailto1 + range: "[]{3},admin,[]{2}" + postfix: "," + - field: mailto2 + range: "[]{2},user1{3}" + - field: estStarted + range: "20201101 000000:1D" + type: timestamp + format: "YY/MM/DD hh::mm:ss" + postfix: "\t" + - field: deadline + range: "20210101 000000:1D" + type: timestamp + format: "YY/MM/DD" + postfix: "\t" + - field: finishedBy + range: "[]{4},admin,[]{4}" + - field: finishedDate + range: "20210101 000000:1D" + type: timestamp + format: "YY/MM/DD hh::mm:ss" + postfix: "\t" + - field: closedReason + range: "[]{4},done,[]{4}"