function LocaleUpdateBase::addLanguage

Same name in other branches
  1. 9 core/modules/locale/tests/src/Functional/LocaleUpdateBase.php \Drupal\Tests\locale\Functional\LocaleUpdateBase::addLanguage()
  2. 10 core/modules/locale/tests/src/Functional/LocaleUpdateBase.php \Drupal\Tests\locale\Functional\LocaleUpdateBase::addLanguage()
  3. 11.x 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 90

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->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
    $this->container
        ->get('language_manager')
        ->reset();
    $this->assertNotEmpty(\Drupal::languageManager()->getLanguage($langcode), new FormattableMarkup('Language %langcode added.', [
        '%langcode' => $langcode,
    ]));
}

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