protected function ParagraphsCollapsedSummaryTest::setUp

File

paragraphs/tests/src/Kernel/ParagraphsCollapsedSummaryTest.php, line 43

Class

ParagraphsCollapsedSummaryTest
Tests the collapsed summary options.

Namespace

Drupal\Tests\paragraphs\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('paragraph');
  $this
    ->installSchema('system', [
    'sequences',
  ]);
  \Drupal::moduleHandler()
    ->loadInclude('paragraphs', 'install');

  // Create a text paragraph type with test_text_color plugin enabled.
  $paragraph_type = ParagraphsType::create(array(
    'label' => 'text_paragraph',
    'id' => 'text_paragraph',
    'behavior_plugins' => [
      'test_text_color' => [
        'enabled' => TRUE,
      ],
    ],
  ));
  $paragraph_type
    ->save();
  $this
    ->addParagraphsField('text_paragraph', 'text', 'string');
  EntityFormDisplay::create([
    'targetEntityType' => 'paragraph',
    'bundle' => 'text_paragraph',
    'mode' => 'default',
    'status' => TRUE,
  ])
    ->setComponent('text', [
    'type' => 'string_textfield',
  ])
    ->save();

  // Add a nested Paragraph type.
  $paragraphs_type = ParagraphsType::create([
    'id' => 'nested_paragraph',
    'label' => 'nested_paragraph',
  ]);
  $paragraphs_type
    ->save();
  $this
    ->addParagraphsField('nested_paragraph', 'nested_paragraph_field', 'entity_reference_revisions', [
    'target_type' => 'paragraph',
  ]);
  EntityFormDisplay::create([
    'targetEntityType' => 'paragraph',
    'bundle' => 'nested_paragraph',
    'mode' => 'default',
    'status' => TRUE,
  ])
    ->setComponent('nested_paragraph_field', [
    'type' => 'paragraphs',
  ])
    ->save();
}