From 3ddcd870870985414d99e475bbdae1fd57b63de3 Mon Sep 17 00:00:00 2001 From: liugang Date: Fri, 7 Nov 2025 15:32:46 +0800 Subject: [PATCH] + [misc] Add unit tests for blockZen::printPlanBlock() 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 --- module/block/test/zen/printplanblock.php | 75 ++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 module/block/test/zen/printplanblock.php diff --git a/module/block/test/zen/printplanblock.php b/module/block/test/zen/printplanblock.php new file mode 100755 index 0000000000..f4353dce83 --- /dev/null +++ b/module/block/test/zen/printplanblock.php @@ -0,0 +1,75 @@ +#!/usr/bin/env php +dashboard = 'my'; +$defaultBlock->params = new stdclass(); +$defaultBlock->params->type = ''; +$defaultBlock->params->count = 15; + +r($blockTest->printPlanBlockTest($defaultBlock)) && p('plansCount') && e('1'); // 步骤1:默认参数测试 + +// 测试type为all的情况 +$allBlock = new stdclass(); +$allBlock->dashboard = 'my'; +$allBlock->params = new stdclass(); +$allBlock->params->type = 'all'; +$allBlock->params->count = 15; + +r($blockTest->printPlanBlockTest($allBlock)) && p('plansCount') && e('1'); // 步骤2:type为all类型测试 + +// 测试count限制为5 +$limit5Block = new stdclass(); +$limit5Block->dashboard = 'my'; +$limit5Block->params = new stdclass(); +$limit5Block->params->type = ''; +$limit5Block->params->count = 5; + +r($blockTest->printPlanBlockTest($limit5Block)) && p('plansCount') && e('1'); // 步骤3:count限制为5测试 + +// 测试count限制为10 +$limit10Block = new stdclass(); +$limit10Block->dashboard = 'my'; +$limit10Block->params = new stdclass(); +$limit10Block->params->type = ''; +$limit10Block->params->count = 10; + +r($blockTest->printPlanBlockTest($limit10Block)) && p('plansCount') && e('1'); // 步骤4:count限制为10测试 + +// 测试type为noproduct的情况 +$noproductBlock = new stdclass(); +$noproductBlock->dashboard = 'my'; +$noproductBlock->params = new stdclass(); +$noproductBlock->params->type = 'noproduct'; +$noproductBlock->params->count = 15; + +r($blockTest->printPlanBlockTest($noproductBlock)) && p('plansCount') && e('1'); // 步骤5:type为noproduct测试 \ No newline at end of file