diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigLanguageOverride.php b/core/modules/config/lib/Drupal/config/Tests/ConfigLanguageOverride.php index 206a8ec..6317d0c 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigLanguageOverride.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigLanguageOverride.php @@ -69,10 +69,11 @@ function testConfigLanguageOverride() { $config = \Drupal::config('config_test.new'); $this->assertTrue($config->isNew(), 'The configuration object config_test.new is new'); $this->assertIdentical($config->get('language'), 'override'); + $old_state = \Drupal::configFactory()->getOverrideState(); \Drupal::configFactory()->setOverrideState(FALSE); $config = \Drupal::config('config_test.new'); $this->assertIdentical($config->get('language'), NULL); - \Drupal::configFactory()->setOverrideState(TRUE); + \Drupal::configFactory()->setOverrideState($old_state); // Ensure that language configuration overrides can not be overridden. global $conf; diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigModuleOverridesTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigModuleOverridesTest.php index fb147ff..c5c7190 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigModuleOverridesTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigModuleOverridesTest.php @@ -40,6 +40,8 @@ public function testSimpleModuleOverrides() { $this->assertTrue($config_factory->getOverrideState(), 'By default ConfigFactory has overrides enabled.'); + $old_state = $config_factory->getOverrideState(); + $config_factory->setOverrideState(FALSE); $this->assertFalse($config_factory->getOverrideState(), 'ConfigFactory can disable overrides.'); $this->assertEqual($non_overridden_name, $config_factory->get('system.site')->get('name')); @@ -53,14 +55,14 @@ public function testSimpleModuleOverrides() { // Test overrides of completely new configuration objects. In normal runtime // this should only happen for configuration entities as we should not be // creating simple configuration objects on the fly. - $config = \Drupal::config('config_override.new'); + $config = $config_factory->get('config_override.new'); $this->assertTrue($config->isNew(), 'The configuration object config_override.new is new'); $this->assertIdentical($config->get('module'), 'override'); - \Drupal::configFactory()->setOverrideState(FALSE); + $config_factory->setOverrideState(FALSE); $config = \Drupal::config('config_override.new'); $this->assertIdentical($config->get('module'), NULL); - \Drupal::configFactory()->setOverrideState(TRUE); + $config_factory->setOverrideState($old_state); unset($GLOBALS['config_test_run_module_overrides']); } } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php index 8abde4a..a535651 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php @@ -122,6 +122,7 @@ function testConfOverride() { $config = \Drupal::config('config_test.new'); $this->assertTrue($config->isNew(), 'The configuration object config_test.new is new'); $this->assertIdentical($config->get('key'), 'override'); + $old_state = \Drupal::configFactory()->getOverrideState(); \Drupal::configFactory()->setOverrideState(FALSE); $config_raw = \Drupal::config('config_test.new'); $this->assertIdentical($config_raw->get('key'), NULL); @@ -129,7 +130,7 @@ function testConfOverride() { ->set('key', 'raw') ->set('new_key', 'new_value') ->save(); - \Drupal::configFactory()->setOverrideState(TRUE); + \Drupal::configFactory()->setOverrideState($old_state); // Ensure override is preserved but all other data has been updated // accordingly. $this->assertIdentical($config->get('key'), 'override'); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigOverridesPriorityTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigOverridesPriorityTest.php index 1cf01e6..b056731 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigOverridesPriorityTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigOverridesPriorityTest.php @@ -92,11 +92,13 @@ public function testOverridePriorities() { $this->assertEqual($language_overridden_mail, $config_factory->get('system.site')->get('mail')); $this->assertEqual(50, $config_factory->get('system.site')->get('weight_select_max')); + $old_state = $config_factory->getOverrideState(); $config_factory->setOverrideState(FALSE); $this->assertEqual($non_overridden_name, $config_factory->get('system.site')->get('name')); $this->assertEqual($non_overridden_slogan, $config_factory->get('system.site')->get('slogan')); $this->assertEqual($non_overridden_mail, $config_factory->get('system.site')->get('mail')); $this->assertEqual(50, $config_factory->get('system.site')->get('weight_select_max')); + $config_factory->setOverrideState($old_state); unset($GLOBALS['config_test_run_module_overrides']); } diff --git a/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleAdminPathConfigEntityConverter.php b/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleAdminPathConfigEntityConverter.php index 1f33c6b..2eca5dd 100644 --- a/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleAdminPathConfigEntityConverter.php +++ b/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleAdminPathConfigEntityConverter.php @@ -55,9 +55,10 @@ public function convert($value, $definition, $name, array $defaults, Request $re $entity_type = substr($definition['type'], strlen('entity:')); if ($storage = $this->entityManager->getStorageController($entity_type)) { // Make sure no overrides are loaded. + $old_state = $this->configFactory->getOverrideState(); $this->configFactory->setOverrideState(FALSE); $entity = $storage->load($value); - $this->configFactory->setOverrideState(TRUE); + $this->configFactory->setOverrideState($old_state); return $entity; } } diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemConfigsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemConfigsTest.php index 9092f3b..0764d72 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemConfigsTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateSystemConfigsTest.php @@ -181,11 +181,12 @@ public function testSystemFile() { $this->prepare($migration, $dumps); $executable = new MigrateExecutable($migration, new MigrateMessage()); $executable->import(); + $old_state = \Drupal::configFactory()->getOverrideState(); \Drupal::configFactory()->setOverrideState(FALSE); $config = \Drupal::config('system.file'); $this->assertIdentical($config->get('path.private'), 'files/test'); $this->assertIdentical($config->get('path.temporary'), 'files/temp'); - \Drupal::configFactory()->setOverrideState(TRUE); + \Drupal::configFactory()->setOverrideState($old_state); } }