function LayoutBuilderEntityViewDisplayValidationTest::setUp

Same name in other branches
  1. 10 core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayValidationTest.php \Drupal\Tests\layout_builder\Kernel\LayoutBuilderEntityViewDisplayValidationTest::setUp()

Overrides ConfigEntityValidationTestBase::setUp

File

core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayValidationTest.php, line 39

Class

LayoutBuilderEntityViewDisplayValidationTest
Tests validation of Layout Builder's entity_view_display entities.

Namespace

Drupal\Tests\layout_builder\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installConfig('node');
    $this->createContentType([
        'type' => 'one',
    ]);
    $this->createContentType([
        'type' => 'two',
    ]);
    EntityTestBundle::create([
        'id' => 'one',
    ])->save();
    EntityTestBundle::create([
        'id' => 'two',
    ])->save();
    EntityViewMode::create([
        'id' => 'node.layout',
        'label' => 'Layout',
        'targetEntityType' => 'node',
    ])->save();
    $this->entity = $this->container
        ->get(EntityDisplayRepositoryInterface::class)
        ->getViewDisplay('node', 'one', 'layout');
    $this->assertInstanceOf(LayoutBuilderEntityViewDisplay::class, $this->entity);
    $this->entity
        ->save();
}

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