You are here

public function ConfigImporterTest::testConfigGetConfigDirectory in Drupal 8

Tests config_get_config_directory().

@group legacy @expectedDeprecation config_get_config_directory() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Site\Settings::get('config_sync_directory') instead. See https://www.drupal.org/node/3018145

File

core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php, line 751

Class

ConfigImporterTest
Tests importing configuration from files into active configuration.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testConfigGetConfigDirectory() {
  global $config_directories;

  // Ensure the global and the setting matches.
  $this
    ->assertSame(config_get_config_directory(CONFIG_SYNC_DIRECTORY), $config_directories[CONFIG_SYNC_DIRECTORY]);
  $message = 'Calling config_get_config_directory() with an invalid key results in an exception.';
  try {
    config_get_config_directory('does_not_exist');
    $this
      ->fail($message);
  } catch (\Exception $e) {
    $this
      ->pass($message);
  }
}