+ [misc] Add unit tests for blockZen::printSingleMonthlyProgressBlock() method

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-11-12 08:25:40 +08:00
co-authored by Claude
parent c69e7eeb25
commit 9868563c8d
2 changed files with 20 additions and 68 deletions
@@ -8,36 +8,37 @@ timeout=0
cid=0
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是1 属性doneStoryEstimateCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是2 属性doneStoryCountCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是3 属性createStoryCountCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是4 属性fixedBugCountCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是5 属性createBugCountCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是1 属性createStoryCountCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是1 属性doneStoryCountCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是1 属性fixedBugCountCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是1 属性createBugCountCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是1 属性releaseCountCount @6
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是2 属性productID @2
- 执行blockTest模块的printSingleMonthlyProgressBlockTest方法,参数是3
- 属性doneStoryEstimateCount @6
- 属性doneStoryCountCount @6
- 属性createStoryCountCount @6
- 属性fixedBugCountCount @6
- 属性createBugCountCount @6
- 属性releaseCountCount @6
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/zen.class.php';
// 准备产品测试数据
zenData('product')->loadYaml('product_printsinglemonthlyprogessblock', false, 2)->gen(5);
// 准备度量项测试数据
zenData('product')->loadYaml('product_printsinglemonthlyprogessblock', false, 2)->gen(10);
zenData('metriclib')->loadYaml('metriclib_printsinglemonthlyprogessblock', false, 2)->gen(100);
su('admin');
$blockTest = new blockZenTest();
// 步骤1:正常情况测试 - 验证产品ID为1时完成需求工时数组有6个月数据
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('doneStoryEstimateCount') && e('6');
// 步骤2:验证产品ID为2时完成需求数数组有6个月数据
r($blockTest->printSingleMonthlyProgressBlockTest(2)) && p('doneStoryCountCount') && e('6');
// 步骤3:验证产品ID为3时新增需求数数组有6个月数据
r($blockTest->printSingleMonthlyProgressBlockTest(3)) && p('createStoryCountCount') && e('6');
// 步骤4:验证产品ID为4时修复Bug数数组有6个月数据
r($blockTest->printSingleMonthlyProgressBlockTest(4)) && p('fixedBugCountCount') && e('6');
// 步骤5:验证产品ID为5时新增Bug数数组有6个月数据
r($blockTest->printSingleMonthlyProgressBlockTest(5)) && p('createBugCountCount') && e('6');
// 步骤6:验证产品ID为1时发布数数组有6个月数据
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('releaseCountCount') && e('6');
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('createStoryCountCount') && e('6');
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('doneStoryCountCount') && e('6');
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('fixedBugCountCount') && e('6');
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('createBugCountCount') && e('6');
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('releaseCountCount') && e('6');
r($blockTest->printSingleMonthlyProgressBlockTest(2)) && p('productID') && e('2');
r($blockTest->printSingleMonthlyProgressBlockTest(3)) && p('doneStoryEstimateCount,doneStoryCountCount,createStoryCountCount,fixedBugCountCount,createBugCountCount,releaseCountCount') && e('6,6,6,6,6,6');
@@ -1,49 +0,0 @@
#!/usr/bin/env php
<?php
/**
title=测试 blockZen::printSingleMonthlyProgressBlock();
timeout=0
cid=0
- 测试步骤1:正常产品获取月度进度数据 >> 返回6个月的完成需求规模数据
- 测试步骤2:正常产品获取月度进度数据 >> 返回6个月的新增需求数数据
- 测试步骤3:正常产品获取月度进度数据 >> 返回6个月的完成需求数数据
- 测试步骤4:正常产品获取月度进度数据 >> 返回6个月的修复Bug数数据
- 测试步骤5:正常产品获取月度进度数据 >> 返回6个月的新增Bug数数据
- 测试步骤6:正常产品获取月度进度数据 >> 返回6个月的发布数数据
- 测试步骤7:验证不同产品ID的数据独立性 >> 返回对应产品的数据
- 测试步骤8:验证所有数据数组的长度一致性 >> 所有数组长度均为6
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/zen.class.php';
// 准备产品测试数据
zenData('product')->loadYaml('product_printsinglemonthlyprogess block', false, 2)->gen(10);
// 准备度量项测试数据
zenData('metriclib')->loadYaml('metriclib_printsinglemonthlyprogess block', false, 2)->gen(100);
su('admin');
$blockTest = new blockZenTest();
// 步骤1:正常产品获取月度进度数据 - 验证返回6个月的完成需求规模数据
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('doneStoryEstimateCount') && e('6');
// 步骤2:正常产品获取月度进度数据 - 验证返回6个月的新增需求数数据
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('createStoryCountCount') && e('6');
// 步骤3:正常产品获取月度进度数据 - 验证返回6个月的完成需求数数据
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('doneStoryCountCount') && e('6');
// 步骤4:正常产品获取月度进度数据 - 验证返回6个月的修复Bug数数据
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('fixedBugCountCount') && e('6');
// 步骤5:正常产品获取月度进度数据 - 验证返回6个月的新增Bug数数据
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('createBugCountCount') && e('6');
// 步骤6:正常产品获取月度进度数据 - 验证返回6个月的发布数数据
r($blockTest->printSingleMonthlyProgressBlockTest(1)) && p('releaseCountCount') && e('6');
// 步骤7:验证不同产品ID的数据独立性 - 返回对应产品的数据
r($blockTest->printSingleMonthlyProgressBlockTest(2)) && p('productID') && e('2');
// 步骤8:验证所有数据数组的长度一致性 - 所有数组长度均为6
r($blockTest->printSingleMonthlyProgressBlockTest(3)) && p('doneStoryEstimateCount,doneStoryCountCount,createStoryCountCount,fixedBugCountCount,createBugCountCount,releaseCountCount') && e('6,6,6,6,6,6');