diff --git a/core/modules/config/config.api.php b/core/modules/config/config.api.php index d3fe095..8f95d32 100644 --- a/core/modules/config/config.api.php +++ b/core/modules/config/config.api.php @@ -44,7 +44,7 @@ function hook_config_import($op, $name, $new_config, $old_config) { $style = $old_config->get(); return image_style_delete($style); } - if ($op == 'new') { + if ($op == 'create') { $style = $new_config->get(); return image_style_save($style); } diff --git a/core/modules/config/config_test/config_test.module b/core/modules/config/config_test/config_test.module index 4a3da4b..f789d4b 100644 --- a/core/modules/config/config_test/config_test.module +++ b/core/modules/config/config_test/config_test.module @@ -26,7 +26,7 @@ function config_test_config_import($op, $name, $new_config, $old_config) { $config_test = new ConfigTest($old_config); $config_test->delete(); } - if ($op == 'new') { + if ($op == 'create') { $config_test = new ConfigTest($new_config); $config_test->save(); } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php index 80ca7fd..09baded 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php @@ -67,26 +67,35 @@ class ConfigImportTest extends WebTestBase { */ function testNew() { $name = 'config_test.new'; + $dynamic_name = 'config_test.dynamic.new'; // Verify the configuration to create does not exist yet. $file_storage = new FileStorage(); $this->assertIdentical($file_storage->exists($name), FALSE, $name . ' not found.'); + $this->assertIdentical($file_storage->exists($dynamic_name), FALSE, $dynamic_name . ' not found.'); // Export. config_export(); - // Create a new configuration object. + // Create new configuration objects. $file_storage->write($name, array( 'add_me' => 'new value', )); + $file_storage->write($dynamic_name, array( + 'id' => 'new', + 'name' => 'New', + )); $this->assertIdentical($file_storage->exists($name), TRUE, $name . ' found.'); + $this->assertIdentical($file_storage->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); // Import. config_import(); - // Verify the value has appeared. + // Verify the values appeared. $config = config($name); $this->assertIdentical($config->get('add_me'), 'new value'); + $config = config($dynamic_name); + $this->assertIdentical($config->get('name'), 'New'); } /** @@ -94,27 +103,37 @@ class ConfigImportTest extends WebTestBase { */ function testUpdated() { $name = 'config_test.system'; + $dynamic_name = 'config_test.dynamic.default'; // Export. config_export(); - // Replace the file content of the existing configuration object. + // Replace the file content of the existing configuration objects. $file_storage = new FileStorage(); $this->assertIdentical($file_storage->exists($name), TRUE, $name . ' found.'); + $this->assertIdentical($file_storage->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); $file_storage->write($name, array( 'foo' => 'beer', )); + $file_storage->write($dynamic_name, array( + 'id' => 'default', + 'name' => 'Updated', + )); - // Verify the active store still returns the default value. + // Verify the active store still returns the default values. $config = config($name); $this->assertIdentical($config->get('foo'), 'bar'); + $config = config($dynamic_name); + $this->assertIdentical($config->get('name'), 'Default'); // Import. config_import(); - // Verify the value was updated. + // Verify the values were updated. $config = config($name); $this->assertIdentical($config->get('foo'), 'beer'); + $config = config($dynamic_name); + $this->assertIdentical($config->get('name'), 'Updated'); } /** @@ -122,6 +141,7 @@ class ConfigImportTest extends WebTestBase { */ function testSyncHooks() { $name = 'config_test.system'; + $dynamic_name = 'config_test.dynamic.default'; // Export. config_export(); @@ -129,7 +149,9 @@ class ConfigImportTest extends WebTestBase { // Delete a file so that hook_config_import() hooks are run. $file_storage = new FileStorage(); $this->assertIdentical($file_storage->exists($name), TRUE, $name . ' found.'); + $this->assertIdentical($file_storage->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); $file_storage->delete($name); + $file_storage->delete($dynamic_name); // Import. config_import(); diff --git a/core/modules/image/image.module b/core/modules/image/image.module index c726952..1be8fe6 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -519,7 +519,7 @@ function image_config_import($op, $name, $new_config, $old_config) { $style = $old_config->get(); return image_style_delete($style); } - if ($op == 'new') { + if ($op == 'create') { $style = $new_config->get(); return image_style_save($style); }