function UserAdminLanguageTest::testUserAdminLanguageConfigurationAvailableWithAdminLanguageNegotiation

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

Tests that admin language negotiation is configurable only if enabled.

File

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

Class

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

Namespace

Drupal\Tests\user\Functional

Code

public function testUserAdminLanguageConfigurationAvailableWithAdminLanguageNegotiation() : void {
    $this->drupalLogin($this->adminUser);
    $this->addCustomLanguage();
    $path = 'user/' . $this->adminUser
        ->id() . '/edit';
    // Checks with user administration pages language negotiation disabled.
    $this->drupalGet($path);
    // Ensure administration pages language settings widget is not available.
    $this->assertSession()
        ->fieldNotExists('edit-preferred-admin-langcode');
    // Checks with user administration pages language negotiation enabled.
    $this->setLanguageNegotiation();
    $this->drupalGet($path);
    // Ensure administration pages language settings widget is available.
    $this->assertSession()
        ->fieldExists('edit-preferred-admin-langcode');
}

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