You are here

protected function LayoutBuilderTranslationTest::setUpEntities in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTranslationTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTranslationTest::setUpEntities()

Setup translated entity with layouts.

1 call to LayoutBuilderTranslationTest::setUpEntities()
LayoutBuilderTranslationTest::setUp in core/modules/layout_builder/tests/src/Functional/LayoutBuilderTranslationTest.php

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderTranslationTest.php, line 148

Class

LayoutBuilderTranslationTest
Tests that the Layout Builder works with translated content.

Namespace

Drupal\Tests\layout_builder\Functional

Code

protected function setUpEntities() {
  $this
    ->drupalLogin($this->administrator);
  $field_ui_prefix = 'entity_test_mul/structure/entity_test_mul';

  // Allow overrides for the layout.
  $this
    ->drupalPostForm("{$field_ui_prefix}/display/default", [
    'layout[enabled]' => TRUE,
  ], 'Save');
  $this
    ->drupalPostForm("{$field_ui_prefix}/display/default", [
    'layout[allow_custom]' => TRUE,
  ], 'Save');

  // @todo The Layout Builder UI relies on local tasks; fix in
  //   https://www.drupal.org/project/drupal/issues/2917777.
  $this
    ->drupalPlaceBlock('local_tasks_block');

  // Create a test entity.
  $id = $this
    ->createEntity([
    $this->fieldName => [
      [
        'value' => 'The untranslated field value',
      ],
    ],
  ], $this->langcodes[0]);
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage($this->entityTypeId);
  $storage
    ->resetCache([
    $id,
  ]);
  $this->entity = $storage
    ->load($id);
}