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.'); + } + } }