Projet

Général

Profil

Paste
Télécharger (897 octets) Statistiques
| Branche: | Révision:

root / drupal7 / modules / simpletest / tests / http.php @ db2d93dd

1
<?php
2

    
3
/**
4
 * @file
5
 * Fake an HTTP request, for use during testing.
6
 */
7

    
8
// Set a global variable to indicate a mock HTTP request.
9
$is_http_mock = !empty($_SERVER['HTTPS']);
10

    
11
// Change to HTTP.
12
$_SERVER['HTTPS'] = NULL;
13
ini_set('session.cookie_secure', FALSE);
14
foreach ($_SERVER as $key => $value) {
15
  $_SERVER[$key] = str_replace('modules/simpletest/tests/http.php', 'index.php', $value);
16
  $_SERVER[$key] = str_replace('https://', 'http://', $_SERVER[$key]);
17
}
18

    
19
// Change current directory to the Drupal root.
20
chdir('../../..');
21
define('DRUPAL_ROOT', getcwd());
22
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
23

    
24
// Make sure this file can only be used by simpletest.
25
drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
26
if (!drupal_valid_test_ua()) {
27
  header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
28
  exit;
29
}
30

    
31
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
32
menu_execute_active_handler();