protected function ParagraphsTestBase::setDefaultParagraphType

Sets the default paragraph type.

Parameters

$content_type: Content type name that contains the paragraphs field.

$paragraphs_name: Paragraphs name.

$paragraphs_field_name: Paragraphs field name to be used.

$default_type: Default paragraph type which should be set.

4 calls to ParagraphsTestBase::setDefaultParagraphType()
ParagraphsAddModesTest::testDefaultParagraphTypeWithSingleType in paragraphs/tests/src/Functional/WidgetLegacy/ParagraphsAddModesTest.php
Tests the default paragraph type behavior for a field with a single type.
ParagraphsAddModesTest::testDefaultParagraphTypeWithSingleType in paragraphs/tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests the default paragraph type behavior for a field with a single type.
ParagraphsAddModesTest::testSettingDefaultParagraphType in paragraphs/tests/src/Functional/WidgetLegacy/ParagraphsAddModesTest.php
Tests if setting for default paragraph type is working properly.
ParagraphsAddModesTest::testSettingDefaultParagraphType in paragraphs/tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests if setting for default paragraph type is working properly.

File

paragraphs/tests/src/Functional/WidgetLegacy/ParagraphsTestBase.php, line 167

Class

ParagraphsTestBase
Base class for tests.

Namespace

Drupal\Tests\paragraphs\Functional\WidgetLegacy

Code

protected function setDefaultParagraphType($content_type, $paragraphs_name, $paragraphs_field_name, $default_type) {
  $this
    ->drupalGet('admin/structure/types/manage/' . $content_type . '/form-display');
  $this
    ->submitForm([], $paragraphs_field_name);
  $this
    ->submitForm([
    'fields[' . $paragraphs_name . '][settings_edit_form][settings][default_paragraph_type]' => $default_type,
  ], 'Update');
  $this
    ->submitForm([], 'Save');
}