X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FEntity%2FConfigEntityImportTest.php;h=88d9bb5d62abe02e5364cd75b446c5311754861c;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=6c5a9d64c59e4acac6292b2a409a6160f169e263;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/system/tests/src/Functional/Entity/ConfigEntityImportTest.php b/web/core/modules/system/tests/src/Functional/Entity/ConfigEntityImportTest.php index 6c5a9d64c..88d9bb5d6 100644 --- a/web/core/modules/system/tests/src/Functional/Entity/ConfigEntityImportTest.php +++ b/web/core/modules/system/tests/src/Functional/Entity/ConfigEntityImportTest.php @@ -21,7 +21,7 @@ class ConfigEntityImportTest extends BrowserTestBase { * * @var array */ - public static $modules = ['action', 'block', 'filter', 'image', 'search', 'search_extra_type']; + public static $modules = ['action', 'block', 'filter', 'image', 'search', 'search_extra_type', 'config_test']; /** * {@inheritdoc} @@ -41,7 +41,9 @@ class ConfigEntityImportTest extends BrowserTestBase { $this->doFilterFormatUpdate(); $this->doImageStyleUpdate(); $this->doSearchPageUpdate(); + $this->doThirdPartySettingsUpdate(); } + /** * Tests updating a action during import. */ @@ -171,6 +173,34 @@ class ConfigEntityImportTest extends BrowserTestBase { $this->assertConfigUpdateImport($name, $original_data, $custom_data); } + /** + * Tests updating of third party settings. + */ + protected function doThirdPartySettingsUpdate() { + // Create a test action with a known label. + $name = 'system.action.third_party_settings_test'; + + /** @var \Drupal\config_test\Entity\ConfigTest $entity */ + $entity = Action::create([ + 'id' => 'third_party_settings_test', + 'plugin' => 'action_message_action', + ]); + $entity->save(); + + $this->assertIdentical([], $entity->getThirdPartyProviders()); + // Get a copy of the configuration before the third party setting is added. + $no_third_part_setting_config = $this->container->get('config.storage')->read($name); + + // Add a third party setting. + $entity->setThirdPartySetting('config_test', 'integer', 1); + $entity->save(); + $this->assertIdentical(1, $entity->getThirdPartySetting('config_test', 'integer')); + $has_third_part_setting_config = $this->container->get('config.storage')->read($name); + + // Ensure configuration imports can completely remove third party settings. + $this->assertConfigUpdateImport($name, $has_third_part_setting_config, $no_third_part_setting_config); + } + /** * Tests that a single set of plugin config stays in sync. *