function AddComponentTest::setUp

Overrides KernelTestBase::setUp

File

core/modules/layout_builder/tests/src/Kernel/Plugin/ConfigAction/AddComponentTest.php, line 50

Class

AddComponentTest
@coversDefaultClass \Drupal\layout_builder\Plugin\ConfigAction\AddComponent[[api-linebreak]]

Namespace

Drupal\Tests\layout_builder\Kernel\Plugin\ConfigAction

Code

protected function setUp() : void {
  parent::setUp();
  EntityTestHelper::createBundle('bundle_with_extra_fields');
  $this->installEntitySchema('entity_test');
  $this->installEntitySchema('user');
  $this->installConfig([
    'layout_builder_defaults_test',
  ]);
  $this->plugin = $this->container
    ->get(SectionStorageManagerInterface::class)
    ->createInstance('defaults');
  $this->configActionManager = $this->container
    ->get('plugin.manager.config_action');
  // Add some extra empty sections.
  $view_display = $this->container
    ->get(EntityTypeManagerInterface::class)
    ->getStorage('entity_view_display')
    ->load('entity_test.bundle_with_extra_fields.default');
  assert($view_display instanceof SectionListInterface);
  $view_display->insertSection(1, new Section('layout_onecol'));
  $view_display->insertSection(2, new Section('layout_threecol_25_50_25'));
  $view_display->save();
}

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