function ContentTranslationSettingsTest::testAccountLanguageSettingsUI

Same name in other branches
  1. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSettingsTest::testAccountLanguageSettingsUI()
  2. 10 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 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.');
}

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