function EntityFormDisplayValidationTest::setUp

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

Overrides ConfigEntityValidationTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Entity/EntityFormDisplayValidationTest.php, line 39

Class

EntityFormDisplayValidationTest
Tests validation of entity_form_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();
    EntityFormMode::create([
        'id' => 'node.test',
        'label' => 'Test',
        'targetEntityType' => 'node',
    ])->save();
    $this->entity = $this->container
        ->get(EntityDisplayRepositoryInterface::class)
        ->getFormDisplay('node', 'one', 'test');
    $this->entity
        ->save();
}

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