function FieldFieldAccessTestBase::setUp

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php \Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase::setUp()
  2. 8.9.x core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php \Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase::setUp()
  3. 10 core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php \Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase::setUp()

Overrides ViewsKernelTestBase::setUp

5 calls to FieldFieldAccessTestBase::setUp()
CommentViewsFieldAccessTest::setUp in core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php
EntityTestViewsFieldAccessTest::setUp in core/modules/views/tests/src/Kernel/Handler/EntityTestViewsFieldAccessTest.php
NodeViewsFieldAccessTest::setUp in core/modules/node/tests/src/Kernel/Views/NodeViewsFieldAccessTest.php
TaxonomyViewsFieldAccessTest::setUp in core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyViewsFieldAccessTest.php
UserViewsFieldAccessTest::setUp in core/modules/user/tests/src/Kernel/Views/UserViewsFieldAccessTest.php
6 methods override FieldFieldAccessTestBase::setUp()
CommentViewsFieldAccessTest::setUp in core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php
EntityTestViewsFieldAccessTest::setUp in core/modules/views/tests/src/Kernel/Handler/EntityTestViewsFieldAccessTest.php
FileViewsFieldAccessTest::setUp in core/modules/file/tests/src/Kernel/Views/FileViewsFieldAccessTest.php
NodeViewsFieldAccessTest::setUp in core/modules/node/tests/src/Kernel/Views/NodeViewsFieldAccessTest.php
TaxonomyViewsFieldAccessTest::setUp in core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyViewsFieldAccessTest.php

... See full list

File

core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php, line 40

Class

FieldFieldAccessTestBase
Provides a base class for base field access in views.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

protected function setUp($import_test_views = TRUE) : void {
    parent::setUp($import_test_views);
    $this->installEntitySchema('user');
    $role_with_access = Role::create([
        'id' => 'with_access',
        'permissions' => [
            'view test entity field',
            'access content',
        ],
        'label' => 'With access',
    ]);
    $role_with_access->save();
    $role_without_access = Role::create([
        'id' => 'without_access',
        'permissions' => [],
        'label' => 'Without access',
    ]);
    $role_without_access->save();
    $this->userWithAccess = User::create([
        'name' => $this->randomMachineName(),
        'roles' => [
            $role_with_access->id(),
        ],
    ]);
    $this->userWithAccess
        ->save();
    $this->userWithoutAccess = User::create([
        'name' => $this->randomMachineName(),
        'roles' => [
            $role_without_access->id(),
        ],
    ]);
    $this->userWithoutAccess
        ->save();
}

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