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