You are here

protected function TranslatableFieldTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/Kernel/TranslatableFieldTest.php \Drupal\Tests\layout_builder\Kernel\TranslatableFieldTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/layout_builder/tests/src/Kernel/TranslatableFieldTest.php, line 38

Class

TranslatableFieldTest
Tests Layout Builder with a translatable layout field.

Namespace

Drupal\Tests\layout_builder\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('entity_test');

  // Create a translation.
  ConfigurableLanguage::createFromLangcode('es')
    ->save();
  LayoutBuilderEntityViewDisplay::create([
    'targetEntityType' => 'entity_test',
    'bundle' => 'entity_test',
    'mode' => 'default',
    'status' => TRUE,
  ])
    ->enableLayoutBuilder()
    ->setOverridable()
    ->save();
  FieldStorageConfig::loadByName('entity_test', OverridesSectionStorage::FIELD_NAME)
    ->setTranslatable(TRUE)
    ->save();
  FieldConfig::loadByName('entity_test', 'entity_test', OverridesSectionStorage::FIELD_NAME)
    ->setTranslatable(TRUE)
    ->save();
}