diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigNamespaceTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigNamespaceTest.php new file mode 100644 index 0000000..694b9e3 --- /dev/null +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigNamespaceTest.php @@ -0,0 +1,55 @@ + 'Namespace', + 'description' => 'Test that an exception is thrown if namespace is missing in Config', + 'group' => 'Configuration', + ); + } + + /** + * Tests CRUD operations. + */ + 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'); + } +}