function LocaleUpdateBase::addLanguage

Same name and namespace in other branches
  1. 9 core/modules/locale/tests/src/Functional/LocaleUpdateBase.php \Drupal\Tests\locale\Functional\LocaleUpdateBase::addLanguage()
  2. 8.9.x core/modules/locale/tests/src/Functional/LocaleUpdateBase.php \Drupal\Tests\locale\Functional\LocaleUpdateBase::addLanguage()
  3. 10 core/modules/locale/tests/src/Functional/LocaleUpdateBase.php \Drupal\Tests\locale\Functional\LocaleUpdateBase::addLanguage()

Adds a language.

Parameters

string $langcode: The language code of the language to add.

3 calls to LocaleUpdateBase::addLanguage()
LocaleUpdateCronTest::setUp in core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php
LocaleUpdateInterfaceTest::testInterface in core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php
Tests the user interfaces of the interface translation update system.
LocaleUpdateTest::setUp in core/modules/locale/tests/src/Functional/LocaleUpdateTest.php

File

core/modules/locale/tests/src/Functional/LocaleUpdateBase.php, line 93

Class

LocaleUpdateBase
Base class for testing updates to string translations.

Namespace

Drupal\Tests\locale\Functional

Code

protected function addLanguage($langcode) {
    $edit = [
        'predefined_langcode' => $langcode,
    ];
    $this->drupalGet('admin/config/regional/language/add');
    $this->submitForm($edit, 'Add language');
    $this->container
        ->get('language_manager')
        ->reset();
    $this->assertNotEmpty(\Drupal::languageManager()->getLanguage($langcode), "Language {$langcode} added.");
}

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