You are here

protected function BaseFieldAccessTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php \Drupal\Tests\views\Functional\Entity\BaseFieldAccessTest::setUp()

Overrides ViewTestBase::setUp

File

core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php, line 40

Class

BaseFieldAccessTest
Tests views base field access.

Namespace

Drupal\Tests\views\Functional\Entity

Code

protected function setUp($import_test_views = TRUE) : void {
  parent::setUp($import_test_views);
  ViewTestData::createTestViews(static::class, [
    'comment_test_views',
  ]);
  \Drupal::state()
    ->set('entity_test.views_data', [
    'entity_test' => [
      'test_text_access' => [
        'field' => [
          'id' => 'standard',
        ],
      ],
    ],
  ]);
  $entity_1 = EntityTest::create([
    'test_text_access' => 'no access value',
  ]);
  $entity_1
    ->save();
  $entity_2 = EntityTest::create([
    'test_text_access' => 'ok to see this one',
  ]);
  $entity_2
    ->save();
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'access content',
  ]));
}