znt/module/repo/test/model/checkgiteaconnection.php

33 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=测试 repoModel::checkGiteaConnection();
timeout=0
cid=18032
- 步骤1测试参数全为空的情况 @0
- 步骤2测试name为空的情况 @0
- 步骤3测试serviceProject为空的情况 @0
- 步骤4测试非gitea类型SCM @0
- 步骤5测试正常gitea参数但项目不存在 @0
- 步骤6测试serviceHost为空但其他参数正常 @0
- 步骤7测试空白字符参数组合 @0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$repoTest = new repoModelTest();
r($repoTest->checkGiteaConnectionTest('', '', '', '')) && p() && e('0'); // 步骤1测试参数全为空的情况
r($repoTest->checkGiteaConnectionTest('gitea', '', '1', 'test')) && p() && e('0'); // 步骤2测试name为空的情况
r($repoTest->checkGiteaConnectionTest('gitea', 'testname', '1', '')) && p() && e('0'); // 步骤3测试serviceProject为空的情况
r($repoTest->checkGiteaConnectionTest('git', 'testname', '1', 'testproject')) && p() && e('0'); // 步骤4测试非gitea类型SCM
r($repoTest->checkGiteaConnectionTest('gitea', 'testname', '1', 'testproject')) && p() && e('0'); // 步骤5测试正常gitea参数但项目不存在
r($repoTest->checkGiteaConnectionTest('gitea', 'testname', '', 'testproject')) && p() && e('0'); // 步骤6测试serviceHost为空但其他参数正常
r($repoTest->checkGiteaConnectionTest('gitea', ' ', '1', ' ')) && p() && e('0'); // 步骤7测试空白字符参数组合