You are here

protected function LocaleUpdateBase::addLanguage in Drupal 10

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

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