function ContentTranslationSettingsTest::testAccountLanguageSettingsUI

Same name and namespace in other branches
  1. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSettingsTest::testAccountLanguageSettingsUI()
  2. 8.9.x core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSettingsTest::testAccountLanguageSettingsUI()
  3. 11.x core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSettingsTest::testAccountLanguageSettingsUI()

Tests the language settings checkbox on account settings page.

File

core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php, line 246

Class

ContentTranslationSettingsTest
Tests the content translation settings UI.

Namespace

Drupal\Tests\content_translation\Functional

Code

public function testAccountLanguageSettingsUI() : void {
  // Make sure the checkbox is available and not checked by default.
  $this->drupalGet('admin/config/people/accounts');
  $this->assertSession()
    ->fieldExists('language[content_translation]');
  $this->assertSession()
    ->checkboxNotChecked('edit-language-content-translation');
  $edit = [
    'language[content_translation]' => TRUE,
  ];
  $this->drupalGet('admin/config/people/accounts');
  $this->submitForm($edit, 'Save configuration');
  $this->drupalGet('admin/config/people/accounts');
  $this->assertSession()
    ->checkboxChecked('edit-language-content-translation');
  // Make sure account settings can be saved.
  $this->drupalGet('admin/config/people/accounts');
  $this->submitForm([
    'anonymous' => 'Save me!',
  ], 'Save configuration');
  $this->assertSession()
    ->fieldValueEquals('anonymous', 'Save me!');
  $this->assertSession()
    ->statusMessageContains('The configuration options have been saved.', 'status');
}

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