You are here

protected function UserEntityReferenceTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Tests/UserEntityReferenceTest.php \Drupal\user\Tests\UserEntityReferenceTest::setUp()

Performs setup tasks before each individual test method is run.

Overrides EntityUnitTestBase::setUp

File

core/modules/user/src/Tests/UserEntityReferenceTest.php, line 40
Contains \Drupal\user\Tests\UserEntityReferenceTest.

Class

UserEntityReferenceTest
Tests the user reference field functionality.

Namespace

Drupal\user\Tests

Code

protected function setUp() {
  parent::setUp();
  $this->role1 = entity_create('user_role', array(
    'id' => strtolower($this
      ->randomMachineName(8)),
    'label' => $this
      ->randomMachineName(8),
  ));
  $this->role1
    ->save();
  $this->role2 = entity_create('user_role', array(
    'id' => strtolower($this
      ->randomMachineName(8)),
    'label' => $this
      ->randomMachineName(8),
  ));
  $this->role2
    ->save();
  $this
    ->createEntityReferenceField('user', 'user', 'user_reference', 'User reference', 'user');
}