public function CKEditorTest::testLanguages in Drupal 9
Same name and namespace in other branches
- 8 core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php \Drupal\Tests\ckeditor\Kernel\CKEditorTest::testLanguages()
Tests language list availability in CKEditor.
File
- core/
modules/ ckeditor/ tests/ src/ Kernel/ CKEditorTest.php, line 391
Class
- CKEditorTest
- Tests for the 'CKEditor' text editor plugin.
Namespace
Drupal\Tests\ckeditor\KernelCode
public function testLanguages() {
// Get CKEditor supported language codes and spot-check.
$this
->enableModules([
'language',
]);
$this
->installConfig([
'language',
]);
$langcodes = $this->ckeditor
->getLangcodes();
// Language codes transformed with browser mappings.
$this
->assertSame('pt', $langcodes['pt-pt'], '"pt" properly resolved');
$this
->assertSame('zh-cn', $langcodes['zh-hans'], '"zh-hans" properly resolved');
// Language code both in Drupal and CKEditor.
$this
->assertSame('gl', $langcodes['gl'], '"gl" properly resolved');
// Language codes only in CKEditor.
$this
->assertSame('en-au', $langcodes['en-au'], '"en-au" properly resolved');
$this
->assertSame('sr-latn', $langcodes['sr-latn'], '"sr-latn" properly resolved');
// No locale module, so even though languages are enabled, CKEditor should
// still be in English.
$this
->assertCKEditorLanguage('en');
}