You are here

protected function EntityDisplayRepositoryTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityDisplayRepositoryTest::setUp()
  2. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityDisplayRepositoryTest::setUp()

File

core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php, line 32

Class

EntityDisplayRepositoryTest
@coversDefaultClass \Drupal\Core\Entity\EntityDisplayRepository

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function setUp() : void {
  parent::setUp();
  $this->displayRepository = \Drupal::service('entity_display.repository');

  // Create a new view mode for users.
  $this->container
    ->get('entity_type.manager')
    ->getStorage('entity_view_mode')
    ->create([
    'id' => 'user.pastafazoul',
    'label' => $this
      ->randomMachineName(),
    'targetEntityType' => 'user',
  ])
    ->save();

  // Create a new form mode for users.
  $this->container
    ->get('entity_type.manager')
    ->getStorage('entity_form_mode')
    ->create([
    'id' => 'user.register',
    'label' => $this
      ->randomMachineName(),
    'targetEntityType' => 'user',
  ])
    ->save();
}