You are here

protected function ParagraphsTestBaseTrait::addParagraphedContentType in Paragraphs 8

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.

60 calls to ParagraphsTestBaseTrait::addParagraphedContentType()
MultilingualBehaviorTest::setUp in modules/paragraphs_library/tests/src/Functional/MultilingualBehaviorTest.php
ParagraphsAccessTest::setUp in tests/src/Functional/WidgetStable/ParagraphsAccessTest.php
ParagraphsAddModesTest::testDefaultParagraphTypeWithSingleType in tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests the default paragraph type behavior for a field with a single type.
ParagraphsAddModesTest::testDropDownMode in tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests the add drop down button.
ParagraphsAddModesTest::testEmptyAllowedTypes in tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests the field creation when no Paragraphs types are available.

... See full list

File

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