znt/module/compile/test/tao/getjenkinsurlprefix.php

35 lines
2.3 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
declare(strict_types=1);
/**
title=测试 compileModel->getJenkinsUrlPrefix().
timeout=0
cid=15758
- 测试当url为http:www.baidu.com, pipeline包含/job/且在开头的情况生成的url链接是否正确。 @http://www.baidu.com/job/Job1
- 测试当url为http:www.google.com, pipeline不包含/job/的情况生成的url链接是否正确。 @http://www.google.com/job/Job2/
- 测试当url为http:www.sina.com.cn, pipeline包含/job/但不在开头的情况生成的url链接是否正确。 @http://www.sina.com.cn/test3/job/Job3
- 测试当url为http:www.baidu.com, pipeline包含/job/且在开头的情况生成的url链接是否正确。 @http://www.baidu.com/job/Job1
- 测试当url为http:www.google.com, pipeline不包含/job/的情况生成的url链接是否正确。 @http://www.google.com/job/Job2
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/tao.class.php';
zenData('job')->gen(1);
su('admin');
$compile = new compileTaoTest();
$urlList = array('http://www.baidu.com', 'http://www.google.com', 'http://www.sina.com.cn');
$pipelineList = array('/job/Job1', 'Job2', '/test3/job/Job3');
r($compile->getJenkinsUrlPrefix($urlList[0], $pipelineList[0])) && p() && e('http://www.baidu.com/job/Job1/'); //测试当url为http://www.baidu.com, pipeline包含/job/且在开头的情况生成的url链接是否正确。
r($compile->getJenkinsUrlPrefix($urlList[1], $pipelineList[1])) && p() && e('http://www.google.com/job/Job2/'); //测试当url为http://www.google.com, pipeline不包含/job/的情况生成的url链接是否正确。
r($compile->getJenkinsUrlPrefix($urlList[2], $pipelineList[2])) && p() && e('http://www.sina.com.cn/test3/job/Job3/'); //测试当url为http://www.sina.com.cn, pipeline包含/job/但不在开头的情况生成的url链接是否正确。
r($compile->getJenkinsUrlPrefix($urlList[0], $pipelineList[2])) && p() && e('http://www.baidu.com/test3/job/Job3/'); //测试当url为http://www.baidu.com, pipeline包含/job/且在开头的情况生成的url链接是否正确。
r($compile->getJenkinsUrlPrefix($urlList[1], $pipelineList[2])) && p() && e('http://www.google.com/test3/job/Job3/'); //测试当url为http://www.google.com, pipeline不包含/job/的情况生成的url链接是否正确。