function CKEditor5Test::testLanguageOfPartsPlugin

Same name in other branches
  1. 9 core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5Test::testLanguageOfPartsPlugin()
  2. 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5Test::testLanguageOfPartsPlugin()

Test for Language of Parts plugin.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php, line 151

Class

CKEditor5Test
Tests for CKEditor 5.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

public function testLanguageOfPartsPlugin() : void {
    $page = $this->getSession()
        ->getPage();
    $assert_session = $this->assertSession();
    $this->languageOfPartsPluginInitialConfigurationHelper($page, $assert_session);
    // Test for "United Nations' official languages" option.
    $languages = LanguageManager::getUnitedNationsLanguageList();
    $this->languageOfPartsPluginConfigureLanguageListHelper($page, $assert_session, 'un');
    $this->languageOfPartsPluginTestHelper($page, $assert_session, $languages);
    // Test for "Drupal predefined languages" option.
    $languages = LanguageManager::getStandardLanguageList();
    $this->languageOfPartsPluginConfigureLanguageListHelper($page, $assert_session, 'all');
    $this->languageOfPartsPluginTestHelper($page, $assert_session, $languages);
    // Test for "Site-configured languages" option.
    ConfigurableLanguage::createFromLangcode('ar')->save();
    ConfigurableLanguage::createFromLangcode('fr')->save();
    ConfigurableLanguage::createFromLangcode('mi')->setName('Māori')
        ->save();
    $configured_languages = \Drupal::languageManager()->getLanguages();
    $languages = [];
    foreach ($configured_languages as $language) {
        $language_name = $language->getName();
        $language_code = $language->getId();
        $languages[$language_code] = [
            $language_name,
        ];
    }
    $this->languageOfPartsPluginConfigureLanguageListHelper($page, $assert_session, 'site_configured');
    $this->languageOfPartsPluginTestHelper($page, $assert_session, $languages);
}

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