diff --git a/test/bootstrap-dist.php b/test/bootstrap-dist.php index dbac6be22c..865e6f770b 100644 --- a/test/bootstrap-dist.php +++ b/test/bootstrap-dist.php @@ -56,6 +56,18 @@ $CFG = new PMA_Config(); define('PMA_VERSION', $CFG->get('PMA_VERSION')); unset($CFG); +// Set proxy information from env, if available +$http_proxy = getenv('http_proxy'); +if ($http_proxy && ($url_info = parse_url($http_proxy))) { + define('PROXY_URL', $url_info['host'] . ':' . $url_info['port']); + define('PROXY_USER', empty($url_info['user']) ? '' : $url_info['user']); + define('PROXY_PASS', empty($url_info['pass']) ? '' : $url_info['pass']); +} else { + define('PROXY_URL', ''); + define('PROXY_USER', ''); + define('PROXY_PASS', ''); +} + // Ensure we have session started session_start(); diff --git a/test/classes/PMA_Util_test.php b/test/classes/PMA_Util_test.php index 20c851d23d..e88b0237d6 100644 --- a/test/classes/PMA_Util_test.php +++ b/test/classes/PMA_Util_test.php @@ -116,8 +116,9 @@ class PMA_Util_Test extends PHPUnit_Framework_TestCase */ public function testGetLatestVersion() { - $GLOBALS['cfg']['ProxyUrl'] = ''; - $GLOBALS['cfg']['VersionCheckProxyUrl'] = ''; + $GLOBALS['cfg']['ProxyUrl'] = PROXY_URL; + $GLOBALS['cfg']['ProxyUser'] = PROXY_USER; + $GLOBALS['cfg']['ProxyPass'] = PROXY_PASS; $GLOBALS['cfg']['VersionCheck'] = true; $version = PMA_Util::getLatestVersion(); $this->assertNotEmpty($version->version);