From 80437713c9bee2d4630dc09e109b81516d48a39b Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 10 Nov 2025 13:25:20 +0800 Subject: [PATCH] + [misc] Add unit tests for blockZen::printSingleMonthlyProgressBlock() method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../zen/printsinglemonthlyprogressblock.php | 42 +++++++++++++++ .../metriclib.yaml | 40 ++++++++++++++ .../product.yaml | 54 +++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100755 module/block/test/zen/printsinglemonthlyprogressblock.php create mode 100644 module/block/test/zen/yaml/printsinglemonthlyprogressblock/metriclib.yaml create mode 100644 module/block/test/zen/yaml/printsinglemonthlyprogressblock/product.yaml diff --git a/module/block/test/zen/printsinglemonthlyprogressblock.php b/module/block/test/zen/printsinglemonthlyprogressblock.php new file mode 100755 index 0000000000..7a63f4baaf --- /dev/null +++ b/module/block/test/zen/printsinglemonthlyprogressblock.php @@ -0,0 +1,42 @@ +#!/usr/bin/env php +loadYaml('printsinglemonthlyprogressblock', false, 2)->gen(10); +zendata('metriclib')->loadYaml('printsinglemonthlyprogressblock', false, 2)->gen(6); + +su('admin'); + +$blockTest = new blockZenTest(); + +r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('doneStoryEstimateCount') && e('6'); +r($blockTest->printSingleMonthlyProgressBlockTest(2)) && p('doneStoryCountCount') && e('6'); +r($blockTest->printSingleMonthlyProgressBlockTest(3)) && p('createStoryCountCount') && e('6'); +r($blockTest->printSingleMonthlyProgressBlockTest(4)) && p('fixedBugCountCount') && e('6'); +r($blockTest->printSingleMonthlyProgressBlockTest(5)) && p('createBugCountCount') && e('6'); +r($blockTest->printSingleMonthlyProgressBlockTest(6)) && p('releaseCountCount') && e('6'); +r($blockTest->printSingleMonthlyProgressBlockTest(7)) && p('doneStoryEstimateCount,doneStoryCountCount,createStoryCountCount,fixedBugCountCount,createBugCountCount,releaseCountCount') && e('6,6,6,6,6,6'); \ No newline at end of file diff --git a/module/block/test/zen/yaml/printsinglemonthlyprogressblock/metriclib.yaml b/module/block/test/zen/yaml/printsinglemonthlyprogressblock/metriclib.yaml new file mode 100644 index 0000000000..e1887468c3 --- /dev/null +++ b/module/block/test/zen/yaml/printsinglemonthlyprogressblock/metriclib.yaml @@ -0,0 +1,40 @@ +--- +title: 度量项库数据定义 +desc: 用于测试printSingleMonthlyProgressBlock方法的度量项库数据 + +fields: +- field: id + note: 度量项ID + range: 1-6 + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: code + note: 度量项代码 + range: scale_of_monthly_finished_story_in_product,count_of_monthly_created_story_in_product,count_of_monthly_finished_story_in_product,count_of_monthly_created_bug_in_product,count_of_monthly_fixed_bug_in_product,count_of_monthly_created_release_in_product + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: name + note: 度量项名称 + range: 产品月度完成需求规模,产品月度新增需求数,产品月度完成需求数,产品月度新增Bug数,产品月度修复Bug数,产品月度发布数 + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: purpose + note: 度量目的 + range: scale{6} + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: deleted + note: 是否删除 + range: 0 + prefix: "" + postfix: "" + loop: 0 + format: "" diff --git a/module/block/test/zen/yaml/printsinglemonthlyprogressblock/product.yaml b/module/block/test/zen/yaml/printsinglemonthlyprogressblock/product.yaml new file mode 100644 index 0000000000..05e3570220 --- /dev/null +++ b/module/block/test/zen/yaml/printsinglemonthlyprogressblock/product.yaml @@ -0,0 +1,54 @@ +--- +title: 产品数据定义 +desc: 用于测试printSingleMonthlyProgressBlock方法的产品数据 + +fields: +- field: id + note: 产品ID + range: 1-10 + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: program + note: 项目集ID + range: 1-3 + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: name + note: 产品名称 + range: 产品1,产品2,产品3,产品4,产品5,产品6,产品7,产品8,产品9,产品10 + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: code + note: 产品代号 + range: product1,product2,product3,product4,product5,product6,product7,product8,product9,product10 + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: type + note: 产品类型 + range: normal + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: status + note: 产品状态 + range: normal + prefix: "" + postfix: "" + loop: 0 + format: "" +- field: deleted + note: 是否删除 + range: 0 + prefix: "" + postfix: "" + loop: 0 + format: ""