Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / paragraphs / src / Tests / Experimental / ParagraphsExperimentalFieldGroupTest.php
1 <?php
2
3 namespace Drupal\paragraphs\Tests\Experimental;
4
5 /**
6  * Tests the field group on node.
7  *
8  * @group paragraphs
9  * @requires module field_group
10  */
11 class ParagraphsExperimentalFieldGroupTest extends ParagraphsExperimentalTestBase {
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);
33
34     $this->addParagraphsType($paragraph_type);
35     $this->addParagraphsType('text');
36     static::fieldUIAddNewField('admin/structure/paragraphs_type/' . $paragraph_type, 'text', 'Text', 'text_long', [], []);
37
38     // Create the field group element on paragraph type.
39     $edit = [
40       'group_formatter' => 'fieldset',
41       'label' => 'paragraph_field_group_title',
42       'group_name' => 'field'
43     ];
44     $this->drupalPostForm('admin/structure/paragraphs_type/' . $paragraph_type . '/form-display/add-group', $edit, t('Save and continue'));
45     $edit = [
46       'format_settings[label]' => 'field_group'
47     ];
48     $this->drupalPostForm(NULL, $edit, t('Create group'));
49
50     // Put the text field into the field group.
51     $edit = [
52       'fields[field_text][parent]' => 'group_field'
53     ];
54     $this->drupalPostForm('admin/structure/paragraphs_type/' . $paragraph_type . '/form-display', $edit, t('Save'));
55
56     // Create a node with a paragraph.
57     $this->drupalGet('node/add/' . $content_type);
58     $this->drupalPostAjaxForm('node/add/' . $content_type, [], 'field_paragraphs_paragraph_type_test_add_more');
59
60     // Test if the new field group is displayed.
61     $this->assertText('field_group');
62     $this->assertFieldByXPath("//fieldset", NULL, t('Fieldset present'));
63
64     // Save the node.
65     $edit = [
66       'title[0][value]' => 'paragraphed_title',
67       'field_paragraphs[0][subform][field_text][0][value]' => 'paragraph_value',
68     ];
69     $this->drupalPostForm(NULL, $edit, t('Save'));
70   }
71
72 }