protected function TestBase::prepareConfigDirectories

Create and set new configuration directories.

The child site uses drupal_valid_test_ua() to adjust the config directory paths to a test-prefix-specific directory within the public files directory.

See also

config_get_config_directory()

2 calls to TestBase::prepareConfigDirectories()
TestBase::prepareEnvironment in drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
Prepares the current environment for running the test.
UpgradePathTestBase::performUpgrade in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
Perform the upgrade.
1 method overrides TestBase::prepareConfigDirectories()

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php, line 948
Definition of Drupal\simpletest\TestBase.

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

protected function prepareConfigDirectories() {
  $GLOBALS['config_directories'] = array();
  $this->configDirectories = array();
  include_once DRUPAL_ROOT . '/core/includes/install.inc';
  foreach (array(
    CONFIG_ACTIVE_DIRECTORY,
    CONFIG_STAGING_DIRECTORY,
  ) as $type) {

    // Assign the relative path to the global variable.
    $path = 'simpletest/' . substr($this->databasePrefix, 10) . '/config_' . $type;
    $GLOBALS['config_directories'][$type]['path'] = $path;

    // Ensure the directory can be created and is writeable.
    if (!install_ensure_config_directory($type)) {
      return FALSE;
    }

    // Provide the already resolved path for tests.
    $this->configDirectories[$type] = $this->originalFileDirectory . '/' . $path;
  }
}