function _drupal_load_test_overrides

Overrides low-level and environment-specific configuration.

Very strictly for internal use only.

Loads settings.php from the simpletest public files directory. These files can change the global $conf, the global $config_directories, the return value of conf_path(), and settings().

Parameters

string $test_prefix: The simpletest prefix.

1 call to _drupal_load_test_overrides()
drupal_valid_test_ua in drupal/core/includes/bootstrap.inc
Returns the test prefix if this is an internal request from SimpleTest.

File

drupal/core/includes/bootstrap.inc, line 2317
Functions that need to be loaded on every Drupal request.

Code

function _drupal_load_test_overrides($test_prefix) {
  global $conf, $config_directories;

  // Do not use the parent site's config directories. Use only the child site's.
  // @see Drupal\simpletest\TestBase::prepareConfigDirectories()
  $path_prefix = 'simpletest/' . substr($test_prefix, 10);
  $config_directories = array();
  foreach (array(
    CONFIG_ACTIVE_DIRECTORY,
    CONFIG_STAGING_DIRECTORY,
  ) as $type) {
    $config_directories[$type] = array(
      'path' => $path_prefix . '/config_' . $type,
    );
  }

  // Check for and load a settings.php file in the simpletest files directory.
  $filename = conf_path() . '/files/' . $path_prefix . '/settings.php';
  if (file_exists($filename)) {
    $settings = settings()
      ->getAll();
    $conf_path =& drupal_static('conf_path');

    // This can override $conf, $conf_path, $settings, and $config_directories.
    include $filename;

    // Keep the overriden $conf_path alive across drupal_static_reset() calls.
    // @see conf_path()
    $settings['simpletest_conf_path'] = $conf_path;
    new Settings($settings);
  }
}