diff -u b/core/includes/bootstrap.inc b/core/includes/bootstrap.inc --- b/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -10,6 +10,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException as DependencyInjectionRuntimeException; use Symfony\Component\HttpFoundation\Request; use Drupal\Core\Language\Language; +use Exception; /** * @file @@ -503,7 +504,7 @@ $path = conf_path() . '/files/' . $config_directories[$type]; } else { - throw new \Exception(format_string('The configuration directory type %type does not exist.', array('%type' => $type))); + throw new Exception(format_string('The configuration directory type %type does not exist.', array('%type' => $type))); } return $path; } diff -u b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php --- b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php @@ -64,8 +64,8 @@ function testDeleted() { $name = 'config_test.system'; $dynamic_name = 'config_test.dynamic.default'; - $storage = new DatabaseStorage(); - $state = new FileStorage(array('directory' => config_get_config_directory(CONFIG_STAGING_DIRECTORY))); + $active_storage = new DatabaseStorage(); + $staging_storage = new FileStorage(array('directory' => config_get_config_directory(CONFIG_STAGING_DIRECTORY))); // Verify the default configuration values exist. $config = config($name); @@ -77,15 +77,15 @@ config_export(); // Delete the configuration objects from the staging directory. - $state->delete($name); - $state->delete($dynamic_name); + $staging_storage->delete($name); + $staging_storage->delete($dynamic_name); // Import. config_import(); // Verify the values have disappeared. - $this->assertIdentical($storage->read($name), FALSE); - $this->assertIdentical($storage->read($dynamic_name), FALSE); + $this->assertIdentical($active_storage->read($name), FALSE); + $this->assertIdentical($active_storage->read($dynamic_name), FALSE); $config = config($name); $this->assertIdentical($config->get('foo'), NULL); @@ -107,27 +107,27 @@ function testNew() { $name = 'config_test.new'; $dynamic_name = 'config_test.dynamic.new'; - $state = new FileStorage(array('directory' => config_get_config_directory(CONFIG_STAGING_DIRECTORY))); + $staging_storage = new FileStorage(array('directory' => config_get_config_directory(CONFIG_STAGING_DIRECTORY))); // Export. config_export(); // Verify the configuration to create does not exist yet. - $this->assertIdentical($state->exists($name), FALSE, $name . ' not found.'); - $this->assertIdentical($state->exists($dynamic_name), FALSE, $dynamic_name . ' not found.'); + $this->assertIdentical($staging_storage->exists($name), FALSE, $name . ' not found.'); + $this->assertIdentical($staging_storage->exists($dynamic_name), FALSE, $dynamic_name . ' not found.'); // Create new configuration objects in the staging directory. $original_name_data = array( 'add_me' => 'new value', ); - $state->write($name, $original_name_data); + $staging_storage->write($name, $original_name_data); $original_dynamic_data = array( 'id' => 'new', 'label' => 'New', ); - $state->write($dynamic_name, $original_dynamic_data); - $this->assertIdentical($state->exists($name), TRUE, $name . ' found.'); - $this->assertIdentical($state->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); + $staging_storage->write($dynamic_name, $original_dynamic_data); + $this->assertIdentical($staging_storage->exists($name), TRUE, $name . ' found.'); + $this->assertIdentical($staging_storage->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); // Import. config_import(); @@ -153,26 +153,26 @@ function testUpdated() { $name = 'config_test.system'; $dynamic_name = 'config_test.dynamic.default'; - $state = new FileStorage(array('directory' => config_get_config_directory(CONFIG_STAGING_DIRECTORY))); + $staging_storage = new FileStorage(array('directory' => config_get_config_directory(CONFIG_STAGING_DIRECTORY))); // Export. config_export(); // Verify that the configuration objects to import exist. - $this->assertIdentical($state->exists($name), TRUE, $name . ' found.'); - $this->assertIdentical($state->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); + $this->assertIdentical($staging_storage->exists($name), TRUE, $name . ' found.'); + $this->assertIdentical($staging_storage->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); // Replace the file content of the existing configuration objects in the // staging directory. $original_name_data = array( 'foo' => 'beer', ); - $state->write($name, $original_name_data); + $staging_storage->write($name, $original_name_data); $original_dynamic_data = array( 'id' => 'default', 'label' => 'Updated', ); - $state->write($dynamic_name, $original_dynamic_data); + $staging_storage->write($dynamic_name, $original_dynamic_data); // Verify the active store still returns the default values. $config = config($name); @@ -190,8 +190,8 @@ $this->assertIdentical($config->get('label'), 'Updated'); // Verify that the original file content is still the same. - $this->assertIdentical($state->read($name), $original_name_data); - $this->assertIdentical($state->read($dynamic_name), $original_dynamic_data); + $this->assertIdentical($staging_storage->read($name), $original_name_data); + $this->assertIdentical($staging_storage->read($dynamic_name), $original_dynamic_data); // Verify that appropriate module API hooks have been invoked. $this->assertTrue(isset($GLOBALS['hook_config_test']['load']));