You are here

function UserAdminLanguageTest::testUserAdminLanguageConfigurationAvailableWithAdminLanguageNegotiation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Tests/UserAdminLanguageTest.php \Drupal\user\Tests\UserAdminLanguageTest::testUserAdminLanguageConfigurationAvailableWithAdminLanguageNegotiation()

Tests that admin language negotiation is configurable only if enabled.

File

core/modules/user/src/Tests/UserAdminLanguageTest.php, line 64
Contains \Drupal\user\Tests\UserAdminLanguageTest.

Class

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

Namespace

Drupal\user\Tests

Code

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
    ->assertNoFieldByXPath($this
    ->constructFieldXpath('id', 'edit-preferred-admin-langcode'), NULL, 'Administration pages language selector not available.');

  // Checks with user administration pages language negotiation enabled.
  $this
    ->setLanguageNegotiation();
  $this
    ->drupalGet($path);

  // Ensure administration pages language settings widget is available.
  $this
    ->assertFieldByXPath($this
    ->constructFieldXpath('id', 'edit-preferred-admin-langcode'), NULL, 'Administration pages language selector is available.');
}