From a7b138cc975506c901c77248a59f90cbfdf8644d Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 17 Sep 2025 09:28:56 +0800 Subject: [PATCH] + [misc] Add unit tests for repoZen::getBranchAndTagOptions() 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 --- .../repo/test/zen/getbranchandtagoptions.php | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 module/repo/test/zen/getbranchandtagoptions.php diff --git a/module/repo/test/zen/getbranchandtagoptions.php b/module/repo/test/zen/getbranchandtagoptions.php new file mode 100755 index 0000000000..f5a9eea4c3 --- /dev/null +++ b/module/repo/test/zen/getbranchandtagoptions.php @@ -0,0 +1,49 @@ +#!/usr/bin/env php +branches = array('master', 'develop', 'feature-branch'); +$normalScm->tags = array('v1.0.0', 'v1.1.0', 'v2.0.0'); + +// 创建模拟SCM对象 - 仅有分支 +$branchOnlyScm = new stdClass(); +$branchOnlyScm->branches = array('master', 'develop'); +$branchOnlyScm->tags = array(); + +// 创建模拟SCM对象 - 仅有标签 +$tagOnlyScm = new stdClass(); +$tagOnlyScm->branches = array(); +$tagOnlyScm->tags = array('v1.0.0', 'v2.0.0'); + +// 创建空SCM对象 +$emptyScm = new stdClass(); +$emptyScm->branches = array(); +$emptyScm->tags = array(); + +r($repoZenTest->getBranchAndTagOptionsTest($normalScm)) && p('0:text') && e('分支'); +r($repoZenTest->getBranchAndTagOptionsTest($branchOnlyScm)) && p('0:text') && e('分支'); +r($repoZenTest->getBranchAndTagOptionsTest($tagOnlyScm)) && p('0:text') && e('标签'); +r($repoZenTest->getBranchAndTagOptionsTest($emptyScm)) && p() && e('0'); +r($repoZenTest->getBranchAndTagOptionsTest(null)) && p() && e('0'); \ No newline at end of file