znt/module/testtask/test/zen/getbrowsebranch.php

43 lines
1.6 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 testtaskZen::getBrowseBranch();
timeout=0
cid=19234
- 执行testtaskTest模块的getBrowseBranchTest方法参数是'master', 'normal' @all
- 执行testtaskTest模块的getBrowseBranchTest方法参数是'', 'multi' @0
- 执行testtaskTest模块的getBrowseBranchTest方法参数是'develop', 'multi' @develop
- 执行testtaskTest模块的getBrowseBranchTest方法参数是'123', 'branch' @123
- 执行testtaskTest模块的getBrowseBranchTest方法参数是'feature-v1.0', 'branch' @feature-v1.0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/testtaskzen.unittest.class.php';
// 模拟用户登录
su('admin');
// 清理 cookie 以确保测试环境干净
helper::setcookie('preBranch', '');
// 创建测试实例
$testtaskTest = new testtaskZenTest();
// 测试步骤1正常产品类型应该返回 'all'
r($testtaskTest->getBrowseBranchTest('master', 'normal')) && p() && e('all');
// 测试步骤2多分支产品类型空分支应该返回空字符串
r($testtaskTest->getBrowseBranchTest('', 'multi')) && p() && e('0');
// 测试步骤3多分支产品类型指定分支应该返回指定分支
r($testtaskTest->getBrowseBranchTest('develop', 'multi')) && p() && e('develop');
// 测试步骤4多分支产品类型数字分支应该返回数字分支
r($testtaskTest->getBrowseBranchTest('123', 'branch')) && p() && e('123');
// 测试步骤5多分支产品类型带特殊字符的分支应该返回带特殊字符的分支
r($testtaskTest->getBrowseBranchTest('feature-v1.0', 'branch')) && p() && e('feature-v1.0');