function ContentTranslationDisableSettingTest::testDisableSetting

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

Tests that entity schemas are up-to-date after enabling translation.

File

core/modules/content_translation/tests/src/Functional/ContentTranslationDisableSettingTest.php, line 35

Class

ContentTranslationDisableSettingTest
Test disabling content translation module.

Namespace

Drupal\Tests\content_translation\Functional

Code

public function testDisableSetting() : void {
    // Define selectors.
    $group_checkbox = 'entity_types[menu_link_content]';
    $translatable_checkbox = 'settings[menu_link_content][menu_link_content][translatable]';
    $language_alterable = 'settings[menu_link_content][menu_link_content][settings][language][language_alterable]';
    $user = $this->drupalCreateUser([
        'administer site configuration',
        'administer content translation',
        'create content translations',
        'administer languages',
    ]);
    $this->drupalLogin($user);
    $assert = $this->assertSession();
    $this->drupalGet('admin/config/regional/content-language');
    $assert->checkboxNotChecked('entity_types[menu_link_content]');
    $edit = [
        $group_checkbox => TRUE,
        $translatable_checkbox => TRUE,
        $language_alterable => TRUE,
    ];
    $this->submitForm($edit, 'Save configuration');
    $assert->statusMessageContains('Settings successfully updated.', 'status');
    $assert->checkboxChecked($group_checkbox);
    $edit = [
        $group_checkbox => FALSE,
        $translatable_checkbox => TRUE,
        $language_alterable => TRUE,
    ];
    $this->submitForm($edit, 'Save configuration');
    $assert->statusMessageContains('Settings successfully updated.', 'status');
    $assert->checkboxNotChecked($group_checkbox);
}

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