function TranslatableFieldTest::setUp

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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();
}

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