Version 1
[yaffs-website] / web / core / modules / content_translation / tests / src / Functional / ContentTranslationEntityBundleUITest.php
diff --git a/web/core/modules/content_translation/tests/src/Functional/ContentTranslationEntityBundleUITest.php b/web/core/modules/content_translation/tests/src/Functional/ContentTranslationEntityBundleUITest.php
new file mode 100644 (file)
index 0000000..163b5e8
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+
+namespace Drupal\Tests\content_translation\Functional;
+
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Tests the content translation behaviours on entity bundle UI.
+ *
+ * @group content_translation
+ */
+class ContentTranslationEntityBundleUITest extends BrowserTestBase {
+
+  public static $modules = ['language', 'content_translation', 'node', 'comment', 'field_ui'];
+
+  protected function setUp() {
+    parent::setUp();
+    $user = $this->drupalCreateUser(['access administration pages', 'administer languages', 'administer content translation', 'administer content types']);
+    $this->drupalLogin($user);
+  }
+
+  /**
+   * Tests content types default translation behaviour.
+   */
+  public function testContentTypeUI() {
+    // Create first content type.
+    $this->drupalCreateContentType(['type' => 'article']);
+    // Enable content translation.
+    $edit = ['language_configuration[content_translation]' => TRUE];
+    $this->drupalPostForm('admin/structure/types/manage/article', $edit, 'Save content type');
+
+    // Make sure add page does not inherit translation configuration from first
+    // content type.
+    $this->drupalGet('admin/structure/types/add');
+    $this->assertNoFieldChecked('edit-language-configuration-content-translation');
+
+    // Create second content type and set content translation.
+    $edit = [
+      'name' => 'Page',
+      'type' => 'page',
+      'language_configuration[content_translation]' => TRUE,
+    ];
+    $this->drupalPostForm('admin/structure/types/add', $edit, 'Save and manage fields');
+
+    // Make sure the settings are saved when creating the content type.
+    $this->drupalGet('admin/structure/types/manage/page');
+    $this->assertFieldChecked('edit-language-configuration-content-translation');
+
+  }
+
+}