You are here

public function UserAdminLanguageTest::setLanguageNegotiation 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::setLanguageNegotiation()
  2. 9 core/modules/user/tests/src/Functional/UserAdminLanguageTest.php \Drupal\Tests\user\Functional\UserAdminLanguageTest::setLanguageNegotiation()

Sets the User interface negotiation detection method.

Enables the "Account preference for administration pages" language detection method for the User interface language negotiation type.

Parameters

bool $admin_first: Whether the admin negotiation should be first.

File

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

Class

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

Namespace

Drupal\Tests\user\Functional

Code

public function setLanguageNegotiation($admin_first = FALSE) {
  $edit = [
    'language_interface[enabled][language-user-admin]' => TRUE,
    'language_interface[enabled][language-url]' => TRUE,
    'language_interface[weight][language-user-admin]' => $admin_first ? -12 : -8,
    'language_interface[weight][language-url]' => -10,
  ];
  $this
    ->drupalGet('admin/config/regional/language/detection');
  $this
    ->submitForm($edit, 'Save settings');
}