You are here

protected function FieldFieldAccessTestBase::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Handler/FieldFieldAccessTestBase.php \Drupal\views\Tests\Handler\FieldFieldAccessTestBase::setUp()

Parameters

bool $import_test_views: Should the views specififed on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

Overrides ViewKernelTestBase::setUp

8 calls to FieldFieldAccessTestBase::setUp()
AggregatorFeedViewsFieldAccessTest::setUp in core/modules/aggregator/src/Tests/Views/AggregatorFeedViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.
AggregatorItemViewsFieldAccessTest::setUp in core/modules/aggregator/src/Tests/Views/AggregatorItemViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.
CommentViewsFieldAccessTest::setUp in core/modules/comment/src/Tests/Views/CommentViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.
EntityTestViewsFieldAccessTest::setUp in core/modules/views/src/Tests/Handler/EntityTestViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.
FileViewsFieldAccessTest::setUp in core/modules/file/src/Tests/Views/FileViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.

... See full list

8 methods override FieldFieldAccessTestBase::setUp()
AggregatorFeedViewsFieldAccessTest::setUp in core/modules/aggregator/src/Tests/Views/AggregatorFeedViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.
AggregatorItemViewsFieldAccessTest::setUp in core/modules/aggregator/src/Tests/Views/AggregatorItemViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.
CommentViewsFieldAccessTest::setUp in core/modules/comment/src/Tests/Views/CommentViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.
EntityTestViewsFieldAccessTest::setUp in core/modules/views/src/Tests/Handler/EntityTestViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.
FileViewsFieldAccessTest::setUp in core/modules/file/src/Tests/Views/FileViewsFieldAccessTest.php
Performs setup tasks before each individual test method is run.

... See full list

File

core/modules/views/src/Tests/Handler/FieldFieldAccessTestBase.php, line 43
Contains \Drupal\views\Tests\Handler\FieldFieldAccessTestBase.

Class

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

Namespace

Drupal\views\Tests\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',
    ],
  ]);
  $role_with_access
    ->save();
  $role_without_access = Role::create([
    'id' => 'without_access',
    'permissions' => [],
  ]);
  $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();
}