You are here

public function ContentTranslationSettingsTest::testAccountLanguageSettingsUI in Drupal 8

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()

Tests the language settings checkbox on account settings page.

File

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

Class

ContentTranslationSettingsTest
Tests the content translation settings UI.

Namespace

Drupal\Tests\content_translation\Functional

Code

public function testAccountLanguageSettingsUI() {

  // Make sure the checkbox is available and not checked by default.
  $this
    ->drupalGet('admin/config/people/accounts');
  $this
    ->assertField('language[content_translation]');
  $this
    ->assertNoFieldChecked('edit-language-content-translation');
  $edit = [
    'language[content_translation]' => TRUE,
  ];
  $this
    ->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration'));
  $this
    ->drupalGet('admin/config/people/accounts');
  $this
    ->assertFieldChecked('edit-language-content-translation');

  // Make sure account settings can be saved.
  $this
    ->drupalPostForm('admin/config/people/accounts', [
    'anonymous' => 'Save me please!',
  ], 'Save configuration');
  $this
    ->assertFieldByName('anonymous', 'Save me please!', 'Anonymous name has been changed.');
  $this
    ->assertText('The configuration options have been saved.');
}