function BaseFieldAccessTest::setUp

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php \Drupal\Tests\views\Functional\Entity\BaseFieldAccessTest::setUp()
  2. 8.9.x core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php \Drupal\Tests\views\Functional\Entity\BaseFieldAccessTest::setUp()
  3. 10 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 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',
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.