diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php index fedffe8..e066a6e 100644 --- a/core/modules/ckeditor/src/Tests/CKEditorTest.php +++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php @@ -7,6 +7,7 @@ namespace Drupal\ckeditor\Tests; +use Drupal\Core\Language\LanguageDefault; use Drupal\simpletest\KernelTestBase; use Drupal\language\Entity\ConfigurableLanguage; @@ -380,6 +381,7 @@ function testJSTranslation() { $this->enableModules(array('language', 'locale')); $this->installSchema('locale', 'locales_source'); $this->installSchema('locale', 'locales_location'); + $this->installSchema('locale', 'locales_target'); $editor = entity_load('editor', 'filtered_html'); $this->ckeditor->getJSSettings($editor); $localeStorage = $this->container->get('locale.storage'); @@ -398,8 +400,16 @@ function testJSTranslation() { * language set in this assertion. */ protected function assertCKEditorLanguage($langcode = 'fr') { + // Set French as the site default language. ConfigurableLanguage::createFromLangcode('fr')->save(); \Drupal::config('system.site')->set('langcode', 'fr')->save(); + + // Reset the language manager so new negotiations attempts will fall back on + // French. Reinject the language manager CKEditor to use the current one. + $this->container->get('language_manager')->reset(); + $this->ckeditor = $this->container->get('plugin.manager.editor')->createInstance('ckeditor'); + + // Test that we now get the expected language. $editor = entity_load('editor', 'filtered_html'); $settings = $this->ckeditor->getJSSettings($editor); $this->assertEqual($settings['language'], $langcode);