From 94e09cee127f67ce9f2196fe219c22646a7ce9ae Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 6 Nov 2025 10:34:23 +0800 Subject: [PATCH] + [misc] Add unit tests for reportModel::getContributionCountTips() 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 --- .../test/model/getcontributioncounttips.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 module/report/test/model/getcontributioncounttips.php diff --git a/module/report/test/model/getcontributioncounttips.php b/module/report/test/model/getcontributioncounttips.php new file mode 100755 index 0000000000..a772398374 --- /dev/null +++ b/module/report/test/model/getcontributioncounttips.php @@ -0,0 +1,52 @@ +#!/usr/bin/env php +gen(5); + +su('admin'); + +global $config; +$originalEdition = $config->edition; + +$report = new reportTest(); +r(strpos($report->getContributionCountTipsTest('company'), '全公司在已选年份的贡献数据,包含:') !== false) && p() && e('1'); // 测试company模式下的贡献数提示信息 +r(strpos($report->getContributionCountTipsTest('dept'), '已选部门的用户在已选年份的贡献数据,包含:') !== false) && p() && e('1'); // 测试dept模式下的贡献数提示信息 +r(strpos($report->getContributionCountTipsTest('user'), '已选用户在已选年份的贡献数据,包含:') !== false) && p() && e('1'); // 测试user模式下的贡献数提示信息 +r(strpos($report->getContributionCountTipsTest(''), '全公司在已选年份的贡献数据,包含:') !== false) && p() && e('1'); // 测试空字符串模式 + +$config->edition = 'open'; +$report2 = new reportTest(); +$tips = $report2->getContributionCountTipsTest('company'); +$config->edition = $originalEdition; +r(strpos($tips, '审计') === false) && p() && e('1'); // 测试开源版配置下不包含特定对象 + +$config->edition = 'biz'; +$report3 = new reportTest(); +$tips = $report3->getContributionCountTipsTest('company'); +$config->edition = $originalEdition; +r(strpos($tips, '审计') === false) && p() && e('1'); // 测试商业版配置下不包含特定对象 + +$report4 = new reportTest(); +r(strpos($report4->getContributionCountTipsTest('company'), '任务') !== false) && p() && e('1'); // 测试正常版本包含任务说明 + +$config->edition = $originalEdition; \ No newline at end of file