function EntityViewDisplayValidationTest::setUp

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Entity/EntityViewDisplayValidationTest.php \Drupal\KernelTests\Core\Entity\EntityViewDisplayValidationTest::setUp()

Overrides ConfigEntityValidationTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Entity/EntityViewDisplayValidationTest.php, line 38

Class

EntityViewDisplayValidationTest
Tests validation of entity_view_display entities.

Namespace

Drupal\KernelTests\Core\Entity

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.test',
        'label' => 'Test',
        'targetEntityType' => 'node',
    ])->save();
    $this->entity = $this->container
        ->get(EntityDisplayRepositoryInterface::class)
        ->getViewDisplay('node', 'one', 'test');
    $this->entity
        ->save();
}

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