You are here

protected function ParagraphsTestBase::setDefaultParagraphType in Paragraphs 8

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 tests/src/Functional/WidgetLegacy/ParagraphsAddModesTest.php
Tests the default paragraph type behavior for a field with a single type.
ParagraphsAddModesTest::testDefaultParagraphTypeWithSingleType in tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests the default paragraph type behavior for a field with a single type.
ParagraphsAddModesTest::testSettingDefaultParagraphType in tests/src/Functional/WidgetLegacy/ParagraphsAddModesTest.php
Tests if setting for default paragraph type is working properly.
ParagraphsAddModesTest::testSettingDefaultParagraphType in tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests if setting for default paragraph type is working properly.

File

tests/src/Functional/WidgetLegacy/ParagraphsTestBase.php, line 169

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');
}