Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / paragraphs / src / Tests / Experimental / ParagraphsExperimentalTypesTest.php
index 773439efc28ffe804e8758b6b3314bde288fae8c..e02520fdcf24d143a71d222bdde78d176d515fda 100644 (file)
@@ -29,7 +29,8 @@ class ParagraphsExperimentalTypesTest extends ParagraphsExperimentalTestBase {
     // Add a test node with a Paragraph.
     $this->drupalGet('node/add/paragraphed_test');
     $this->drupalPostAjaxForm(NULL, [], 'paragraphs_paragraph_type_test_add_more');
-    $this->drupalPostForm(NULL, ['title[0][value]' => 'test_node'], t('Save and publish'));
+    $edit = ['title[0][value]' => 'test_node'];
+    $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->assertText('paragraphed_test test_node has been created.');
 
     // Attempt to delete the paragraph type already used.
@@ -38,4 +39,25 @@ class ParagraphsExperimentalTypesTest extends ParagraphsExperimentalTestBase {
     $this->assertText('paragraph_type_test Paragraphs type is used by 1 piece of content on your site. You can not remove this paragraph_type_test Paragraphs type until you have removed all from the content.');
   }
 
+  /**
+   * Tests creating paragraph type.
+   */
+  public function testCreateParagraphType() {
+    $this->loginAsAdmin();
+
+    // Add a paragraph type.
+    $this->drupalGet('/admin/structure/paragraphs_type/add');
+
+    // Create a paragraph type with label and id more than 32 characters.
+    $edit = [
+      'label' => 'Test',
+      'id' => 'test_name_with_more_than_32_characters'
+    ];
+    $this->drupalPostForm(NULL, $edit, 'Save and manage fields');
+    $this->assertNoErrorsLogged();
+    $this->assertText('Machine-readable name cannot be longer than 32 characters but is currently 38 characters long.');
+    $edit['id'] = 'new_test_id';
+    $this->drupalPostForm(NULL, $edit, 'Save and manage fields');
+    $this->assertText('Saved the Test Paragraphs type.');
+  }
 }