function FieldFieldAccessTestBase::setUp

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

Overrides ViewsKernelTestBase::setUp

8 calls to FieldFieldAccessTestBase::setUp()
AggregatorFeedViewsFieldAccessTest::setUp in core/modules/aggregator/tests/src/Kernel/Views/AggregatorFeedViewsFieldAccessTest.php
AggregatorItemViewsFieldAccessTest::setUp in core/modules/aggregator/tests/src/Kernel/Views/AggregatorItemViewsFieldAccessTest.php
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

... See full list

8 methods override FieldFieldAccessTestBase::setUp()
AggregatorFeedViewsFieldAccessTest::setUp in core/modules/aggregator/tests/src/Kernel/Views/AggregatorFeedViewsFieldAccessTest.php
AggregatorItemViewsFieldAccessTest::setUp in core/modules/aggregator/tests/src/Kernel/Views/AggregatorItemViewsFieldAccessTest.php
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

... See full list

File

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

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) {
    parent::setUp($import_test_views);
    $this->installEntitySchema('user');
    $role_with_access = Role::create([
        'id' => 'with_access',
        'permissions' => [
            'view test entity field',
        ],
        '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.