Backup of db before drupal security update
[yaffs-website] / web / core / modules / content_translation / tests / src / Functional / ContentTranslationEntityBundleUITest.php
1 <?php
2
3 namespace Drupal\Tests\content_translation\Functional;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests the content translation behaviours on entity bundle UI.
9  *
10  * @group content_translation
11  */
12 class ContentTranslationEntityBundleUITest extends BrowserTestBase {
13
14   public static $modules = ['language', 'content_translation', 'node', 'comment', 'field_ui'];
15
16   protected function setUp() {
17     parent::setUp();
18     $user = $this->drupalCreateUser(['access administration pages', 'administer languages', 'administer content translation', 'administer content types']);
19     $this->drupalLogin($user);
20   }
21
22   /**
23    * Tests content types default translation behaviour.
24    */
25   public function testContentTypeUI() {
26     // Create first content type.
27     $this->drupalCreateContentType(['type' => 'article']);
28     // Enable content translation.
29     $edit = ['language_configuration[content_translation]' => TRUE];
30     $this->drupalPostForm('admin/structure/types/manage/article', $edit, 'Save content type');
31
32     // Make sure add page does not inherit translation configuration from first
33     // content type.
34     $this->drupalGet('admin/structure/types/add');
35     $this->assertNoFieldChecked('edit-language-configuration-content-translation');
36
37     // Create second content type and set content translation.
38     $edit = [
39       'name' => 'Page',
40       'type' => 'page',
41       'language_configuration[content_translation]' => TRUE,
42     ];
43     $this->drupalPostForm('admin/structure/types/add', $edit, 'Save and manage fields');
44
45     // Make sure the settings are saved when creating the content type.
46     $this->drupalGet('admin/structure/types/manage/page');
47     $this->assertFieldChecked('edit-language-configuration-content-translation');
48
49   }
50
51 }