Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / content_translation / tests / src / Functional / ContentTranslationDisableSettingTest.php
1 <?php
2
3 namespace Drupal\Tests\content_translation\Functional;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Test disabling content translation module.
9  *
10  * @group content_translation
11  */
12 class ContentTranslationDisableSettingTest extends BrowserTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static $modules = [
18     'content_translation',
19     'menu_link_content',
20     'language',
21   ];
22
23   /**
24    * Tests that entity schemas are up-to-date after enabling translation.
25    */
26   public function testDisableSetting() {
27     // Define selectors.
28     $group_checkbox = 'entity_types[menu_link_content]';
29     $translatable_checkbox = 'settings[menu_link_content][menu_link_content][translatable]';
30     $language_alterable = 'settings[menu_link_content][menu_link_content][settings][language][language_alterable]';
31
32     $user = $this->drupalCreateUser([
33       'administer site configuration',
34       'administer content translation',
35       'create content translations',
36       'administer languages',
37     ]);
38     $this->drupalLogin($user);
39
40     $assert = $this->assertSession();
41
42     $this->drupalGet('admin/config/regional/content-language');
43
44     $assert->checkboxNotChecked('entity_types[menu_link_content]');
45
46     $edit = [
47       $group_checkbox => TRUE,
48       $translatable_checkbox => TRUE,
49       $language_alterable => TRUE,
50     ];
51     $this->submitForm($edit, t('Save configuration'));
52
53     $assert->pageTextContains(t('Settings successfully updated.'));
54
55     $assert->checkboxChecked($group_checkbox);
56
57     $edit = [
58       $group_checkbox => FALSE,
59       $translatable_checkbox => TRUE,
60       $language_alterable => TRUE,
61     ];
62     $this->submitForm($edit, t('Save configuration'));
63
64     $assert->pageTextContains(t('Settings successfully updated.'));
65
66     $assert->checkboxNotChecked($group_checkbox);
67   }
68
69 }