function UserFieldsTest::setUp

Same name in other branches
  1. 9 core/modules/user/tests/src/Kernel/UserFieldsTest.php \Drupal\Tests\user\Kernel\UserFieldsTest::setUp()
  2. 8.9.x core/modules/user/tests/src/Kernel/UserFieldsTest.php \Drupal\Tests\user\Kernel\UserFieldsTest::setUp()
  3. 11.x core/modules/user/tests/src/Kernel/UserFieldsTest.php \Drupal\Tests\user\Kernel\UserFieldsTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/user/tests/src/Kernel/UserFieldsTest.php, line 25

Class

UserFieldsTest
Tests available user fields in twig.

Namespace

Drupal\Tests\user\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('user');
    // Set up a test theme that prints the user's mail field.
    \Drupal::service('theme_installer')->install([
        'user_test_theme',
    ]);
    \Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('user_test_theme'));
    // Clear the theme registry.
    $this->container
        ->set('theme.registry', NULL);
}

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