You are here

protected function RevisionBasicUITest::setUp in Entity API 8

Same name and namespace in other branches
  1. 8.0 tests/src/Kernel/RevisionBasicUITest.php \Drupal\Tests\entity\Kernel\RevisionBasicUITest::setUp()

Overrides KernelTestBase::setUp

File

tests/src/Kernel/RevisionBasicUITest.php, line 24

Class

RevisionBasicUITest
@group entity

Namespace

Drupal\Tests\entity\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('entity_test_enhanced');
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installConfig([
    'system',
  ]);
  $this->container
    ->get('router.builder')
    ->rebuild();

  // Create a test user so that the mock requests performed below have a valid
  // current user context.
  $user = User::create([
    // Make sure not to create user 1 which would bypass any access
    // restrictions.
    'uid' => 2,
    'name' => 'Test user',
  ]);
  $user
    ->save();
  $this->container
    ->get('account_switcher')
    ->switchTo($user);
}