protected function EntityDisplayRepositoryTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityDisplayRepositoryTest::setUp()
Overrides KernelTestBase::setUp
File
- core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityDisplayRepositoryTest.php, line 32
Class
- EntityDisplayRepositoryTest
- @coversDefaultClass \Drupal\Core\Entity\EntityDisplayRepository
Namespace
Drupal\KernelTests\Core\EntityCode
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();
}