znt/module/sonarqube/test/model/getapibase.php

35 lines
1.8 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=测试 sonarqubeModel::getApiBase();
timeout=0
cid=18383
- 测试步骤1有效sonarqubeID获取API基础信息 @https://sonar.example.com/api/%s
- 测试步骤2不存在的sonarqubeID获取API基础信息 @return empty
- 测试步骤3负数sonarqubeID获取API基础信息 @return empty
- 测试步骤4零值sonarqubeID获取API基础信息 @return empty
- 测试步骤5字符串类型sonarqubeID获取API基础信息 @return empty
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$table = zenData('pipeline');
$table->id->range('1-10');
$table->type->range('sonarqube{5},jenkins{3},gitlab{2}');
$table->name->range('SonarQube1,SonarQube2,SonarQube3,Jenkins1,Jenkins2');
$table->url->range('https://sonardev.qc.oop.cc,https://sonar.example.com,http://localhost:9000');
$table->token->range('admin:password123,user:token456,test:secret789');
$table->deleted->range('0{8},1{2}');
$table->gen(10);
$sonarqube = new sonarqubeModelTest();
r($sonarqube->getApiBaseTest(2)) && p() && e('https://sonar.example.com/api/%s'); // 测试步骤1有效sonarqubeID获取API基础信息
r($sonarqube->getApiBaseTest(999)) && p() && e('return empty'); // 测试步骤2不存在的sonarqubeID获取API基础信息
r($sonarqube->getApiBaseTest(-1)) && p() && e('return empty'); // 测试步骤3负数sonarqubeID获取API基础信息
r($sonarqube->getApiBaseTest(0)) && p() && e('return empty'); // 测试步骤4零值sonarqubeID获取API基础信息
r($sonarqube->getApiBaseTest('abc')) && p() && e('return empty'); // 测试步骤5字符串类型sonarqubeID获取API基础信息