Mercurial > hg > rr-repo
comparison modules/simpletest/tests/https.php @ 0:ff03f76ab3fe
initial version
author | danieleb <danielebarchiesi@me.com> |
---|---|
date | Wed, 21 Aug 2013 18:51:11 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ff03f76ab3fe |
---|---|
1 <?php | |
2 | |
3 /** | |
4 * @file | |
5 * Fake an HTTPS request, for use during testing. | |
6 */ | |
7 | |
8 // Set a global variable to indicate a mock HTTPS request. | |
9 $is_https_mock = empty($_SERVER['HTTPS']); | |
10 | |
11 // Change to HTTPS. | |
12 $_SERVER['HTTPS'] = 'on'; | |
13 foreach ($_SERVER as $key => $value) { | |
14 $_SERVER[$key] = str_replace('modules/simpletest/tests/https.php', 'index.php', $value); | |
15 $_SERVER[$key] = str_replace('http://', 'https://', $_SERVER[$key]); | |
16 } | |
17 | |
18 // Change current directory to the Drupal root. | |
19 chdir('../../..'); | |
20 define('DRUPAL_ROOT', getcwd()); | |
21 require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
22 | |
23 // Make sure this file can only be used by simpletest. | |
24 drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION); | |
25 if (!drupal_valid_test_ua()) { | |
26 header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); | |
27 exit; | |
28 } | |
29 | |
30 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
31 menu_execute_active_handler(); |