You are here

public function FieldReportTest::setUp in Field Permissions 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/FieldReportTest.php \Drupal\Tests\field_permissions\Functional\FieldReportTest::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/Functional/FieldReportTest.php, line 44

Class

FieldReportTest
Test the field permissions report page.

Namespace

Drupal\Tests\field_permissions\Functional

Code

public function setUp() {
  parent::setUp();
  $admin = $this
    ->drupalCreateUser([
    'administer field permissions',
    'access site reports',
  ]);
  $this
    ->drupalLogin($admin);

  // Add a field.
  // Set up the field_test field.
  $this->fieldStorage = FieldStorageConfig::create([
    'field_name' => 'field_test',
    'type' => 'integer',
    'entity_type' => 'entity_test',
  ]);
  $this->fieldStorage
    ->save();
  $field = FieldConfig::create([
    'field_name' => 'field_test',
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
  ]);
  $field
    ->save();
}