You are here

protected function TranslatableFieldTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Kernel/TranslatableFieldTest.php \Drupal\Tests\layout_builder\Kernel\TranslatableFieldTest::setUp()
  2. 10 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() {
  parent::setUp();
  $this
    ->installSchema('system', [
    'key_value_expire',
  ]);
  $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();
}