You are here

protected function FieldFormatterFromViewDisplayTest::setUp in (Entity Reference) Field Formatters 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/Plugin/Field/FieldFormatter/FieldFormatterFromViewDisplayTest.php \Drupal\Tests\field_formatter\Kernel\Plugin\Field\FieldFormatter\FieldFormatterFromViewDisplayTest::setUp()
  2. 3.x tests/src/Kernel/Plugin/Field/FieldFormatter/FieldFormatterFromViewDisplayTest.php \Drupal\Tests\field_formatter\Kernel\Plugin\Field\FieldFormatter\FieldFormatterFromViewDisplayTest::setUp()

Overrides KernelTestBase::setUp

File

tests/src/Kernel/Plugin/Field/FieldFormatter/FieldFormatterFromViewDisplayTest.php, line 41

Class

FieldFormatterFromViewDisplayTest
@coversDefaultClass \Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterFromViewDisplay @group field_formatter

Namespace

Drupal\Tests\field_formatter\Kernel\Plugin\Field\FieldFormatter

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installSchema('system', [
    'sequences',
  ]);
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('user');
  $admin_role = Role::create([
    'id' => 'admin',
    'permissions' => [
      'view test entity',
    ],
  ]);
  $admin_role
    ->save();
  $this->adminUser = User::create([
    'name' => $this
      ->randomMachineName(),
    'roles' => [
      $admin_role
        ->id(),
    ],
  ]);
  $this->adminUser
    ->save();
  \Drupal::currentUser()
    ->setAccount($this->adminUser);
}