function UserAdminLanguageTest::addCustomLanguage

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

Class

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

Namespace

Drupal\Tests\user\Functional

Code

public function addCustomLanguage() : void {
    $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.