You are here

protected function NodeAccessGrantsCacheContextTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php \Drupal\Tests\node\Functional\NodeAccessGrantsCacheContextTest::setUp()

Overrides NodeTestBase::setUp

File

core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php, line 40

Class

NodeAccessGrantsCacheContextTest
Tests the node access grants cache context service.

Namespace

Drupal\Tests\node\Functional

Code

protected function setUp() : void {
  parent::setUp();
  node_access_rebuild();

  // Create some content.
  $this
    ->drupalCreateNode();
  $this
    ->drupalCreateNode();
  $this
    ->drupalCreateNode();
  $this
    ->drupalCreateNode();

  // Create user with simple node access permission. The 'node test view'
  // permission is implemented and granted by the node_access_test module.
  $this->accessUser = $this
    ->drupalCreateUser([
    'access content overview',
    'access content',
    'node test view',
  ]);
  $this->noAccessUser = $this
    ->drupalCreateUser([
    'access content overview',
    'access content',
  ]);
  $this->noAccessUser2 = $this
    ->drupalCreateUser([
    'access content overview',
    'access content',
  ]);
  $this->userMapping = [
    1 => $this->rootUser,
    2 => $this->accessUser,
    3 => $this->noAccessUser,
  ];
}