Merge pull request #1773 from nisargjhaveri/tests

Fix tests, use proxy settings from env
This commit is contained in:
Marc Delisle 2015-07-02 12:50:06 -04:00
commit 135289ca25
2 changed files with 15 additions and 2 deletions

View File

@ -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();

View File

@ -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);