Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / paragraphs / src / Tests / Classic / ParagraphsFieldGroupTest.php
1 <?php
2
3 namespace Drupal\paragraphs\Tests\Classic;
4
5 /**
6  * Tests the field group on node.
7  *
8  * @group paragraphs
9  * @requires module field_group
10  */
11 class ParagraphsFieldGroupTest extends ParagraphsTestBase {
12
13   /**
14    * Modules to enable.
15    *
16    * @var array
17    */
18   public static $modules = [
19     'field_group',
20   ];
21
22   /**
23    * Tests the field group inside paragraph.
24    */
25   public function testFieldGroup() {
26     $this->loginAsAdmin();
27
28     $paragraph_type = 'paragraph_type_test';
29     $content_type = 'paragraphed_test';
30
31     // Add a Paragraphed test content type.
32     $this->addParagraphedContentType($content_type, 'field_paragraphs', 'entity_reference_paragraphs');
33     $this->addParagraphsType($paragraph_type);
34     $this->addParagraphsType('text');
35     static::fieldUIAddNewField('admin/structure/paragraphs_type/' . $paragraph_type, 'text', 'Text', 'text_long', [], []);
36
37     // Create the field group element on paragraph type.
38     $edit = [
39       'group_formatter' => 'fieldset',
40       'label' => 'paragraph_field_group_title',
41       'group_name' => 'field'
42     ];
43     $this->drupalPostForm('admin/structure/paragraphs_type/' . $paragraph_type . '/form-display/add-group', $edit, t('Save and continue'));
44     $edit = [
45       'format_settings[label]' => 'field_group'
46     ];
47     $this->drupalPostForm(NULL, $edit, t('Create group'));
48
49     // Put the text field into the field group.
50     $edit = [
51       'fields[field_text][parent]' => 'group_field'
52     ];
53     $this->drupalPostForm('admin/structure/paragraphs_type/' . $paragraph_type . '/form-display', $edit, t('Save'));
54
55     // Create a node with a paragraph.
56     $this->drupalGet('node/add/' . $content_type);
57     $this->drupalPostAjaxForm('node/add/' . $content_type, [], 'field_paragraphs_paragraph_type_test_add_more');
58
59     // Test if the new field group is displayed.
60     $this->assertText('field_group');
61     $this->assertFieldByXPath("//fieldset", NULL, t('Fieldset present'));
62
63     // Save the node.
64     $edit = [
65       'title[0][value]' => 'paragraphed_title',
66       'field_paragraphs[0][subform][field_text][0][value]' => 'paragraph_value',
67     ];
68     $this->drupalPostForm(NULL, $edit, t('Save'));
69   }
70 }