diff --git a/core/includes/config.inc b/core/includes/config.inc index 390de18..5a1e661 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -2,7 +2,6 @@ use Drupal\Core\Config\Config; use Drupal\Core\Config\ConfigException; -use Drupal\Core\Config\DatabaseStorage; use Drupal\Core\Config\FileStorage; use Drupal\Core\Config\NullStorage; use Drupal\Core\Config\StorageInterface; diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php index 37aa854..bc3655c 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php @@ -8,6 +8,7 @@ namespace Drupal\config\Tests; use Drupal\Core\Config\DatabaseStorage; +use Drupal\Core\Config\ConfigException; use Drupal\simpletest\WebTestBase; /** @@ -112,4 +113,28 @@ class ConfigCRUDTest extends WebTestBase { // their order must be identical. $this->assertIdentical($new_config->get(), $config->get()); } + /** + * Tests saving a config object without a namespace. + */ + function testNamespace() { + $name = 'nonamespace'; + try { + $config = config($name); + $config->save(); + $this->fail('Expected exception ConfigException was not thrown.'); + } + catch (ConfigException $e) { + $this->pass('Expected exception ConfigException was thrown.'); + } + + $name = 'config.namespace'; + try { + $config = config($name); + $config->save(); + $this->pass('Exception ConfigException was not thrown.'); + } + catch (ConfigException $e) { + $this->fail('Exception ConfigException was thrown.'); + } + } } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigNamespaceTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigNamespaceTest.php deleted file mode 100644 index bd5413e..0000000 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigNamespaceTest.php +++ /dev/null @@ -1,58 +0,0 @@ - 'Namespace', - 'description' => 'Test that an exception is thrown if namespace is missing in Config.', - 'group' => 'Configuration', - ); - } - - /** - * Tests saving a config object without a namespace. - */ - function testNamespace() { - $name = 'nonamespace'; - $caught_exception = FALSE; - try { - $config = config($name); - $config->save(); - } - catch (ConfigException $e) { - if ($e->getMessage() == 'Missing namespace in Config name nonamespace') { - $caught_exception = TRUE; - } - } - $this->assertTrue($caught_exception, 'No Namespace exception caught when namespace not specified in config name.'); - - $name = 'config.namespace'; - $caught_exception = FALSE; - try { - $config = config($name); - $config->save(); - } - catch (ConfigException $e) { - if ($e->getMessage() == 'Missing namespace in Config name nonamespace') { - $caught_exception = TRUE; - } - } - $this->assertFalse($caught_exception, 'No Namespace exception not caught when namespace exists in config name.'); - } - -}