protected function CKEditorTest::assertCKEditorLanguage in Drupal 10
Same name and namespace in other branches
- 8 core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php \Drupal\Tests\ckeditor\Kernel\CKEditorTest::assertCKEditorLanguage()
- 9 core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php \Drupal\Tests\ckeditor\Kernel\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.
File
- core/
modules/ ckeditor/ tests/ src/ Kernel/ CKEditorTest.php, line 480
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']);
}