diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-12-17 22:02:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-12-17 22:02:26 +0000 |
commit | 8d114ca4265b97c9d74592947aedce58cabed6e7 (patch) | |
tree | ee12ab250abd60aede7951ff7f80a3dfb57b7d0e /scripts | |
parent | 20dbb2f2aafc4e296d86571641242d52ff94a17a (diff) | |
download | brdo-8d114ca4265b97c9d74592947aedce58cabed6e7.tar.gz brdo-8d114ca4265b97c9d74592947aedce58cabed6e7.tar.bz2 |
- Patch #648268 by boombatower: allow run-tests.sh to work with https.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/run-tests.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 7dc16e4b6..43e08a1a1 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -117,7 +117,8 @@ All arguments are long options. --url Immediately preceeds a URL to set the host and path. You will need this parameter if Drupal is in a subdirectory on your - localhost and you have not set \$base_url in settings.php. + localhost and you have not set \$base_url in settings.php. Tests + can be run under SSL by including https:// in the URL. --php The absolute path to the PHP executable. Usually not needed. @@ -264,6 +265,12 @@ function simpletest_script_init($server_software) { $parsed_url = parse_url($args['url']); $host = $parsed_url['host'] . (isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''); $path = $parsed_url['path']; + + // If the passed URL schema is 'https' then setup the $_SERVER variables + // properly so that testing will run under https. + if ($parsed_url['scheme'] == 'https') { + $_SERVER['HTTPS'] = 'on'; + } } $_SERVER['HTTP_HOST'] = $host; @@ -277,6 +284,13 @@ function simpletest_script_init($server_software) { $_SERVER['PHP_SELF'] = $path .'/index.php'; $_SERVER['HTTP_USER_AGENT'] = 'Drupal command line'; + if ($_SERVER['HTTPS'] == 'on') { + // Ensure that any and all environment variables are changed to https://. + foreach ($_SERVER as $key => $value) { + $_SERVER[$key] = str_replace('http://', 'https://', $_SERVER[$key]); + } + } + chdir(realpath(dirname(__FILE__) . '/..')); define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; |