You are here

function CKEditorTest::testLanguages in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/ckeditor/src/Tests/CKEditorTest.php \Drupal\ckeditor\Tests\CKEditorTest::testLanguages()

Tests language list availability in CKEditor.

File

core/modules/ckeditor/src/Tests/CKEditorTest.php, line 359
Contains \Drupal\ckeditor\Tests\CKEditorTest.

Class

CKEditorTest
Tests for the 'CKEditor' text editor plugin.

Namespace

Drupal\ckeditor\Tests

Code

function testLanguages() {

  // Get CKEditor supported language codes and spot-check.
  $this
    ->enableModules(array(
    'language',
  ));
  $this
    ->installConfig(array(
    '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');
}