function CKEditorTest::assertCKEditorLanguage
Assert that CKEditor picks the expected language when French is default.
@internal
Parameters
string $langcode: Language code to assert for. Defaults to French. That is the default language set in this assertion.
2 calls to CKEditorTest::assertCKEditorLanguage()
- CKEditorTest::testJSTranslation in core/
modules/ ckeditor/ tests/ src/ Kernel/ CKEditorTest.php  - Tests that CKEditor plugins participate in JS translation.
 - CKEditorTest::testLanguages in core/
modules/ ckeditor/ tests/ src/ Kernel/ CKEditorTest.php  - Tests language list availability in CKEditor.
 
File
- 
              core/
modules/ ckeditor/ tests/ src/ Kernel/ CKEditorTest.php, line 484  
Class
- CKEditorTest
 - Tests for the 'CKEditor' text editor plugin.
 
Namespace
Drupal\Tests\ckeditor\KernelCode
protected function assertCKEditorLanguage(string $langcode = 'fr') : void {
  // Set French as the site default language.
  ConfigurableLanguage::createFromLangcode('fr')->save();
  $this->config('system.site')
    ->set('default_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 = Editor::load('filtered_html');
  $settings = $this->ckeditor
    ->getJSSettings($editor);
  $this->assertEquals($langcode, $settings['language']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.