function _drupal_simpletest_conf_path

Determines whether to use an overridden value for conf_path().

Simpletest may provide a secondary, test-specific settings.php file to load after the primary one used by the parent site and override its variables.

  • If the child settings.php does not override $conf_path, then this function

returns FALSE and conf_path() returns the directory of the primary settings.php.

  • If the child settings.php does override $conf_path, then

_drupal_load_test_overrides() sets the 'simpletest_conf_path' setting, and this function returns that to conf_path(), causing installations and upgrades to act on that one.

Return value

string|false The overridden $conf_path, or FALSE if the $conf_path should not currently be overridden.

See also

conf_path()

_drupal_load_test_overrides()

1 call to _drupal_simpletest_conf_path()
conf_path in drupal/core/includes/bootstrap.inc
Returns the appropriate configuration directory.

File

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

Code

function _drupal_simpletest_conf_path() {

  // Ensure that the settings object is available. conf_path() is called once
  // before the Settings class is included, and at that point it should still
  // load the primary $conf_path. See drupal_settings_initialize().
  if (!class_exists('Drupal\\Component\\Utility\\Settings', FALSE)) {
    return FALSE;
  }

  // If no $simpletest_conf_path is set, use the normal $conf_path.
  if (!($simpletest_conf_path = settings()
    ->get('simpletest_conf_path'))) {
    return FALSE;
  }

  // Ensure that this is actually a simpletest request. We can't check this
  // before settings.php is loaded.
  if (!drupal_valid_test_ua()) {
    return FALSE;
  }

  // When the $simpletest_conf_path is set in a valid test request,
  // return that path.
  return $simpletest_conf_path;
}