protected function ParagraphsTestBaseTrait::addParagraphedContentType

Adds a content type with a Paragraphs field.

Parameters

string $content_type_name: Content type name to be used.

string $paragraphs_field_name: (optional) Field name to be used. Defaults to 'field_paragraphs'.

string $widget_type: (optional) Declares if we use stable or legacy widget. Defaults to 'paragraphs' for stable widget. Use 'entity_reference_paragraphs' for legacy widget.

83 calls to ParagraphsTestBaseTrait::addParagraphedContentType()
MultilingualBehaviorTest::setUp in paragraphs/modules/paragraphs_library/tests/src/Functional/MultilingualBehaviorTest.php
ParagraphsAccessTest::setUp in paragraphs/tests/src/Functional/WidgetStable/ParagraphsAccessTest.php
ParagraphsAccordionPluginTest::setUp in paragraphs_collection/modules/paragraphs_collection_demo/tests/src/Functional/ParagraphsAccordionPluginTest.php
ParagraphsAddModesTest::testDefaultParagraphTypeWithSingleType in paragraphs/tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests the default paragraph type behavior for a field with a single type.
ParagraphsAddModesTest::testDropDownMode in paragraphs/tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests the add drop down button.

... See full list

File

paragraphs/tests/src/FunctionalJavascript/ParagraphsTestBaseTrait.php, line 40

Class

ParagraphsTestBaseTrait
Test trait for Paragraphs JS tests.

Namespace

Drupal\Tests\paragraphs\FunctionalJavascript

Code

protected function addParagraphedContentType($content_type_name, $paragraphs_field_name = 'field_paragraphs', $widget_type = 'paragraphs') {

  // Create the content type.
  $node_type = NodeType::create([
    'type' => $content_type_name,
    'name' => $content_type_name,
  ]);
  $node_type
    ->save();
  $this
    ->addParagraphsField($content_type_name, $paragraphs_field_name, 'node', $widget_type);
}