function LayoutBuilderTranslationTest::setUpEntities

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()
  2. 8.9.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderTranslationTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTranslationTest::setUpEntities()
  3. 11.x 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 142

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);
  // @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',
      ],
    ],
    'name' => 'Test entity',
  ], $this->langcodes[0]);
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage($this->entityTypeId);
  $storage->resetCache([
    $id,
  ]);
  $this->entity = $storage->load($id);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.