You are here

public function ParagraphsSetsFunctionalTestTrait::addParagraphSet in Paragraphs Sets 8.2

Create a paragraphs set.

Parameters

string $paragraphSet: The machine name for the new paragraphs set.

string $config: Configuration for the new paragraphs set. Defaults to an empty set.

1 call to ParagraphsSetsFunctionalTestTrait::addParagraphSet()
ParagraphSetBasicFunctionality::setUp in tests/src/Functional/ParagraphSetBasicFunctionality.php

File

tests/src/Traits/ParagraphsSetsFunctionalTestTrait.php, line 64

Class

ParagraphsSetsFunctionalTestTrait
Contains functions common to functional paragraphs sets tests.

Namespace

Drupal\Tests\paragraphs_sets\Traits

Code

public function addParagraphSet(string $paragraphSet, string $config = 'paragraphs: []') {
  $decodedConfig = Yaml::decode($config);
  $paragraphsSet = ParagraphsSet::create([
    'id' => $paragraphSet,
    'label' => $paragraphSet,
    'description' => $paragraphSet,
    'paragraphs' => $decodedConfig['paragraphs'],
  ]);
  $paragraphsSet
    ->save();
}