You are here

protected function ParagraphsUiTest::setUp in Paragraphs 8

Same name in this branch
  1. 8 tests/src/Functional/WidgetLegacy/ParagraphsUiTest.php \Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsUiTest::setUp()
  2. 8 tests/src/Functional/WidgetStable/ParagraphsUiTest.php \Drupal\Tests\paragraphs\Functional\WidgetStable\ParagraphsUiTest::setUp()

Overrides ParagraphsTestBase::setUp

File

tests/src/Functional/WidgetLegacy/ParagraphsUiTest.php, line 32

Class

ParagraphsUiTest
Tests the Paragraphs user interface.

Namespace

Drupal\Tests\paragraphs\Functional\WidgetLegacy

Code

protected function setUp() : void {
  parent::setUp();
  ConfigurableLanguage::create([
    'id' => 'de',
    'label' => '1German',
  ])
    ->save();
  ConfigurableLanguage::create([
    'id' => 'fr',
    'label' => '2French',
  ])
    ->save();
  $this
    ->addParagraphedContentType('paragraphed_content_demo', 'field_paragraphs_demo', 'entity_reference_paragraphs');
  $this
    ->loginAsAdmin([
    'administer site configuration',
    'administer content translation',
    'administer languages',
  ]);
  $this
    ->addParagraphsType('nested_paragraph');
  $this
    ->addParagraphsField('nested_paragraph', 'field_paragraphs_demo', 'paragraph', 'entity_reference_paragraphs');
  $this
    ->addParagraphsType('images');
  static::fieldUIAddNewField('admin/structure/paragraphs_type/images', 'images_demo', 'Images', 'image', [
    'cardinality' => -1,
  ], [
    'settings[alt_field]' => FALSE,
  ]);
  $this
    ->addParagraphsType('text_image');
  static::fieldUIAddNewField('admin/structure/paragraphs_type/text_image', 'image_demo', 'Images', 'image', [
    'cardinality' => -1,
  ], [
    'settings[alt_field]' => FALSE,
  ]);
  static::fieldUIAddNewField('admin/structure/paragraphs_type/text_image', 'text_demo', 'Text', 'text_long', [], []);
  $this
    ->addParagraphsType('text');
  static::fieldUIAddExistingField('admin/structure/paragraphs_type/text', 'field_text_demo', 'Text', []);
  $edit = [
    'entity_types[node]' => TRUE,
    'entity_types[paragraph]' => TRUE,
    'settings[node][paragraphed_content_demo][translatable]' => TRUE,
    'settings[node][paragraphed_content_demo][fields][field_paragraphs_demo]' => FALSE,
    'settings[paragraph][images][translatable]' => TRUE,
    'settings[paragraph][text_image][translatable]' => TRUE,
    'settings[paragraph][text][translatable]' => TRUE,
    'settings[paragraph][nested_paragraph][translatable]' => TRUE,
    'settings[paragraph][nested_paragraph][fields][field_paragraphs_demo]' => FALSE,
    'settings[paragraph][nested_paragraph][settings][language][language_alterable]' => TRUE,
    'settings[paragraph][images][fields][field_images_demo]' => TRUE,
    'settings[paragraph][text_image][fields][field_image_demo]' => TRUE,
    'settings[paragraph][text_image][fields][field_text_demo]' => TRUE,
    'settings[node][paragraphed_content_demo][settings][language][language_alterable]' => TRUE,
  ];
  $this
    ->drupalGet('admin/config/regional/content-language');
  $this
    ->submitForm($edit, 'Save configuration');
}