function CKEditorTest::testLanguages

Same name in other branches
  1. 9 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 379

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->assertTrue($langcodes['pt-pt'] == 'pt', '"pt" properly resolved');
    $this->assertTrue($langcodes['zh-hans'] == 'zh-cn', '"zh-hans" properly resolved');
    // Language code both in Drupal and CKEditor.
    $this->assertTrue($langcodes['gl'] == 'gl', '"gl" properly resolved');
    // Language codes only in CKEditor.
    $this->assertTrue($langcodes['en-au'] == 'en-au', '"en-au" properly resolved');
    $this->assertTrue($langcodes['sr-latn'] == '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.