function CKEditorTest::testLanguages

Same name in other branches
  1. 8.9.x 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 396

Class

CKEditorTest
Tests for the 'CKEditor' text editor plugin.

Namespace

Drupal\Tests\ckeditor\Kernel

Code

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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.