You are here

public function UserAdminLanguageTest::testUserAdminLanguageConfigurationAvailableWithAdminLanguageNegotiation 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::testUserAdminLanguageConfigurationAvailableWithAdminLanguageNegotiation()

Tests that admin language negotiation is configurable only if enabled.

File

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

Class

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

Namespace

Drupal\Tests\user\Functional

Code

public function testUserAdminLanguageConfigurationAvailableWithAdminLanguageNegotiation() {
  $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');
}