ContentTranslationDisableSettingTest.php in Drupal 9
File
core/modules/content_translation/tests/src/Functional/ContentTranslationDisableSettingTest.php
View source
<?php
namespace Drupal\Tests\content_translation\Functional;
use Drupal\Tests\BrowserTestBase;
class ContentTranslationDisableSettingTest extends BrowserTestBase {
protected static $modules = [
'content_translation',
'menu_link_content',
'language',
];
protected $defaultTheme = 'stark';
public function testDisableSetting() {
$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
->pageTextContains('Settings successfully updated.');
$assert
->checkboxChecked($group_checkbox);
$edit = [
$group_checkbox => FALSE,
$translatable_checkbox => TRUE,
$language_alterable => TRUE,
];
$this
->submitForm($edit, 'Save configuration');
$assert
->pageTextContains('Settings successfully updated.');
$assert
->checkboxNotChecked($group_checkbox);
}
}