function NodeAccessGrantsCacheContextTest::setUp
Overrides NodeTestBase::setUp
File
- 
              core/
modules/ node/ tests/ src/ Functional/ NodeAccessGrantsCacheContextTest.php, line 52  
Class
- NodeAccessGrantsCacheContextTest
 - Tests the node access grants cache context service.
 
Namespace
Drupal\Tests\node\FunctionalCode
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,
  ];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.