You are here

public function UserAdminLanguageTest::addCustomLanguage in Drupal 9

Same name and namespace in other branches
  1. 8 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()

Helper method for adding a custom language.

3 calls to UserAdminLanguageTest::addCustomLanguage()
UserAdminLanguageTest::testActualNegotiation in core/modules/user/tests/src/Functional/UserAdminLanguageTest.php
Tests the actual language negotiation.
UserAdminLanguageTest::testUserAdminLanguageConfigurationAvailableIfAdminLanguageNegotiationIsEnabled in core/modules/user/tests/src/Functional/UserAdminLanguageTest.php
Tests that the admin language is configurable only for administrators.
UserAdminLanguageTest::testUserAdminLanguageConfigurationAvailableWithAdminLanguageNegotiation in core/modules/user/tests/src/Functional/UserAdminLanguageTest.php
Tests that admin language negotiation is configurable only if enabled.

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