Commit 3693ba75 authored by catch's avatar catch

Issue #2625216 by alexpott:...

Issue #2625216 by alexpott: LocaleConfigManager::getTranslatableDefaultConfig() reads config from uninstalled modules
parent 7e80e5b8
......@@ -7,7 +7,7 @@
namespace Drupal\locale;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\ExtensionInstallStorage;
use Drupal\Core\Config\StorageInterface;
use Drupal\language\ConfigurableLanguageManagerInterface;
......@@ -66,8 +66,8 @@ public function __construct(StorageInterface $config_storage, ConfigurableLangua
$this->configStorage = $config_storage;
$this->languageManager = $language_manager;
$this->requiredInstallStorage = new InstallStorage();
$this->optionalInstallStorage = new InstallStorage(InstallStorage::CONFIG_OPTIONAL_DIRECTORY);
$this->requiredInstallStorage = new ExtensionInstallStorage($this->configStorage);
$this->optionalInstallStorage = new ExtensionInstallStorage($this->configStorage, ExtensionInstallStorage::CONFIG_OPTIONAL_DIRECTORY);
}
/**
......
......@@ -61,4 +61,17 @@ public function testGetStringTranslation() {
$this->assertFalse($translation_after->isNew());
$translation_after->setString('updated_translation')->save();
}
/**
* Tests getDefaultConfigLangcode().
*/
public function testGetDefaultConfigLangcode() {
// Install the Language module's configuration so we can use the
// module_installer service.
$this->installConfig(['language']);
$this->assertNull(\Drupal::service('locale.config_manager')->getDefaultConfigLangcode('locale_test_translate.settings'), 'Before installing a module the locale config manager can not access the shipped configuration.');
\Drupal::service('module_installer')->install(['locale_test_translate']);
$this->assertEqual('en', \Drupal::service('locale.config_manager')->getDefaultConfigLangcode('locale_test_translate.settings'), 'After installing a module the locale config manager can get the shipped configuration langcode.');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment