diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php index 7ec6d8e..a4d573f 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php @@ -46,5 +46,9 @@ class ConfigInstallTest extends WebTestBase { // Verify that configuration import callback was invoked for the dynamic // thingie. $this->assertTrue($GLOBALS['hook_config_import']); + + // Verify that the imported configuration object was saved through the + // module API. + $this->assertIdentical($config->get('version'), VERSION); } } diff --git a/core/modules/config/tests/config_test/config/config_test.dynamic.default.yml b/core/modules/config/tests/config_test/config/config_test.dynamic.default.yml index 3e50e3b..3dd16eb 100644 --- a/core/modules/config/tests/config_test/config/config_test.dynamic.default.yml +++ b/core/modules/config/tests/config_test/config/config_test.dynamic.default.yml @@ -1,2 +1,3 @@ id: default label: Default +version: 1.0 diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module index 6fd84a2..644655f 100644 --- a/core/modules/config/tests/config_test/config_test.module +++ b/core/modules/config/tests/config_test/config_test.module @@ -12,7 +12,15 @@ function config_test_config_import_create($name, $new_config, $old_config) { // Set a global value we can check in test code. $GLOBALS['hook_config_import'] = __FUNCTION__; - $new_config->save(); + // This config object has been saved through the current module API. + // There is no guarantee that the module API uses $new_config directly, + // nor a hard requirement for configurable thingies to be based on Config + // objects. Therefore, mock these possible scenarios. + $config = config($name, $new_config->get()); + // Therefore, its version property should equal the current version. + $config->set('version', VERSION); + + $config->save(); return TRUE; }