function UserAdminLanguageTest::addCustomLanguage

Same name and namespace in other branches
  1. 11.x core/modules/user/tests/src/Functional/UserAdminLanguageTest.php \Drupal\Tests\user\Functional\UserAdminLanguageTest::addCustomLanguage()
  2. 10 core/modules/user/tests/src/Functional/UserAdminLanguageTest.php \Drupal\Tests\user\Functional\UserAdminLanguageTest::addCustomLanguage()
  3. 8.9.x core/modules/user/tests/src/Functional/UserAdminLanguageTest.php \Drupal\Tests\user\Functional\UserAdminLanguageTest::addCustomLanguage()

Helper method for adding a custom language.

File

core/modules/user/tests/src/Functional/UserAdminLanguageTest.php, line 193

Class

UserAdminLanguageTest
Tests users' ability to change their own administration language.

Namespace

Drupal\Tests\user\Functional

Code

public function addCustomLanguage() {
  $langcode = 'xx';
  // The English name for the language.
  $name = $this->randomMachineName(16);
  $edit = [
    'predefined_langcode' => 'custom',
    'langcode' => $langcode,
    'label' => $name,
    'direction' => LanguageInterface::DIRECTION_LTR,
  ];
  $this->drupalGet('admin/config/regional/language/add');
  $this->submitForm($edit, 'Add custom language');
}

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