@@ -117,7 +117,8 @@ All arguments are long options.
117117
118118 --url Immediately preceeds a URL to set the host and path. You will
119119 need this parameter if Drupal is in a subdirectory on your
120- localhost and you have not set \$ base_url in settings.php.
120+ localhost and you have not set \$ base_url in settings.php. Tests
121+ can be run under SSL by including https:// in the URL.
121122
122123 --php The absolute path to the PHP executable. Usually not needed.
123124
@@ -264,6 +265,12 @@ function simpletest_script_init($server_software) {
264265 $parsed_url = parse_url($args [' url' ]);
265266 $host = $parsed_url [' host' ] . (isset($parsed_url [' port' ]) ? ' :' . $parsed_url [' port' ] : ' ' );
266267 $path = $parsed_url [' path' ];
268+
269+ // If the passed URL schema is ' https' then setup the $_SERVER variables
270+ // properly so that testing will run under https.
271+ if ($parsed_url [' scheme' ] == ' https' ) {
272+ $_SERVER [' HTTPS' ] = ' on' ;
273+ }
267274 }
268275
269276 $_SERVER [' HTTP_HOST' ] = $host ;
@@ -277,6 +284,13 @@ function simpletest_script_init($server_software) {
277284 $_SERVER [' PHP_SELF' ] = $path .' /index.php' ;
278285 $_SERVER [' HTTP_USER_AGENT' ] = ' Drupal command line' ;
279286
287+ if ($_SERVER [' HTTPS' ] == ' on' ) {
288+ // Ensure that any and all environment variables are changed to https://.
289+ foreach ($_SERVER as $key => $value ) {
290+ $_SERVER [$key ] = str_replace(' http://' , ' https://' , $_SERVER [$key ]);
291+ }
292+ }
293+
280294 chdir(realpath(dirname(__FILE__) . ' /..' ));
281295 define(' DRUPAL_ROOT' , getcwd ());
282296 require_once DRUPAL_ROOT . ' /includes/bootstrap.inc' ;
0 commit comments