You are here

public function DisableFieldTest::testDisableFieldWithParagraphsField in Disable Field 8.2

Test the disable_field module with a paragraphs field.

File

tests/src/Functional/DisableFieldTest.php, line 353

Class

DisableFieldTest
Disable field tests.

Namespace

Drupal\Tests\disable_field\Functional

Code

public function testDisableFieldWithParagraphsField() {
  $this
    ->addParagraphedContentType('paragraphed_content_type');

  // Disable the paragraph field on the add and edit form.
  $this
    ->drupalGet('/admin/structure/types/manage/test/fields/node.paragraphed_content_type.field_paragraphs');
  $this
    ->submitForm([
    'disable_field[add][disable]' => 'all',
    'disable_field[edit][disable]' => 'all',
  ], 'Save settings');

  // Add a Paragraph type.
  $paragraph_type = 'text_paragraph';
  $this
    ->addParagraphsType($paragraph_type);

  // Add a text field to the text_paragraph type.
  $this
    ->fieldUIAddNewField('admin/structure/paragraphs_type/' . $paragraph_type, 'text', 'Text', 'text_long');
  $this
    ->drupalGet('/node/add/paragraphed_content_type');
  $this
    ->checkIfFieldIsDisabledById('edit-field-paragraphs-0-subform-field-text-0-value');
  $this
    ->checkIfFieldIsDisabledById('field-paragraphs-text-paragraph-add-more');
}