* Unit test

This commit is contained in:
zenggang
2022-01-14 09:09:25 +00:00
parent 7c981830b6
commit 3630c5f718
4 changed files with 67 additions and 10 deletions
+9 -9
View File
@@ -3,24 +3,24 @@ author: Zeng gang
version: "1.0"
fields:
- field: id
range: 1
range: 1-2
- field: type
range: gitlab
range: gitlabi,sonarqube
- field: name
range: gitlab服务器
range: gitlab服务器,sonarqube服务器
- field: url
range: [http://192.168.1.161:51080]
range: [http://192.168.1.161:51080],[http://192.168.1.161:59001]
- field: account
range: []
range: [],[admin]
- field: password
range: []
range: [],[UDJzc3cwcmQ=]
- field: token
range: x88fZokrp5hShia2jyBN
range: x88fZokrp5hShia2jyBN,YWRtaW46UDJzc3cwcmQ=
- field: private
range: 08bcc98f75d7d40053dc80722bdc117b
range: 08bcc98f75d7d40053dc80722bdc117b,228b25587479f2fc7570428e8bcbabdc
- field: createdBy
range: admin
- field: createdDate
range: [2021-12-09 11:23:35]
range: [2021-12-09 11:23:35],[2022-01-12 08:47:37]
- field: deleted
range: 0
+1 -1
View File
@@ -16,6 +16,6 @@ $builder->branch = array('rows' => 240, 'extends' => array('branch'));
$builder->build = array('rows' => 8, 'extends' => array('build'));
$builder->release = array('rows' => 8, 'extends' => array('release'));
$builder->pipeline = array('rows' => 1, 'extends' => array('pipeline'));
$builder->pipeline = array('rows' => 2, 'extends' => array('pipeline'));
$builder->repo = array('rows' => 1, 'extends' => array('repo'));
$builder->mr = array('rows' => 1, 'extends' => array('mr'));
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 sonarqubeModel::apiGetProjects();
cid=1
pid=1
通过sonarqubeID,获取SonarQube项目列表 >> 1
通过sonarqubeID,获取SonarQube项目数量 >> 1
通过sonarqubeID,关键字,搜索获取SonarQube项目 >> 1
当sonarqubeID为0时,获取SonarQube项目列表 >> return empty
*/
$sonarqube = $tester->loadModel('sonarqube');
$sonarqubeID = 2;
$result = $sonarqube->apiGetProjects($sonarqubeID);
r(isset($result[0]->name)) && p() && e(1); //通过sonarqubeID,获取SonarQube项目列表
r(count($result) > 0) && p() && e(1); //通过sonarqubeID,获取SonarQube项目数量
$keyword = '02';
$result = $sonarqube->apiGetProjects($sonarqubeID, $keyword);
r(strpos($result[0]->name, '02') !== false) && p() && e(1); //通过sonarqubeID,关键字,搜索获取SonarQube项目
$sonarqubeID = 0;
$result = $sonarqube->apiGetProjects($sonarqubeID);
if(empty($result)) $result = 'return empty';
r($result) && p() && e('return empty'); //当sonarqubeID为0时,获取SonarQube项目列表
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 sonarqubeModel::getApiBase();
cid=1
pid=1
通过sonarqubeID,获取SonarQube url和header >> http://192.168.1.161:59001/api/%s
当sonarqubeID为0时,获取SonarQube url和header >> return empty
*/
$sonarqube = $tester->loadModel('sonarqube');
$sonarqubeID = 2;
list($apiRoot, $header) = $sonarqube->getApiBase($sonarqubeID);
r($apiRoot) && p() && e('http://192.168.1.161:59001/api/%s'); //通过sonarqubeID,获取SonarQube url和header
$sonarqubeID = 0;
list($apiRoot, $header) = $sonarqube->getApiBase($sonarqubeID);
if(empty($apiRoot)) $result = 'return empty';
r($result) && p() && e('return empty'); //当sonarqubeID为0时,获取SonarQube url和header