You are here

public function UserAdminLanguageTest::addCustomLanguage in Drupal 10

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

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');
}