You are here

protected function BaseFieldAccessTest::setUp in Drupal 10

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()
  2. 9 core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php \Drupal\Tests\views\Functional\Entity\BaseFieldAccessTest::setUp()

File

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

Class

BaseFieldAccessTest
Tests views base field access.

Namespace

Drupal\Tests\views\Functional\Entity

Code

protected function setUp($import_test_views = TRUE, $modules = [
  'views_test_config',
  'comment_test_views',
]) : void {
  parent::setUp($import_test_views, $modules);
  \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',
  ]));
}