function NodeAccessTestBase::setUp

Same name in other branches
  1. 9 core/modules/node/tests/src/Kernel/NodeAccessTestBase.php \Drupal\Tests\node\Kernel\NodeAccessTestBase::setUp()
  2. 8.9.x core/modules/node/tests/src/Kernel/NodeAccessTestBase.php \Drupal\Tests\node\Kernel\NodeAccessTestBase::setUp()
  3. 11.x core/modules/node/tests/src/Kernel/NodeAccessTestBase.php \Drupal\Tests\node\Kernel\NodeAccessTestBase::setUp()

Overrides KernelTestBase::setUp

4 calls to NodeAccessTestBase::setUp()
NodeAccessLanguageAwareCombinationTest::setUp in core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php
NodeAccessLanguageAwareTest::setUp in core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php
NodeAccessLanguageTest::setUp in core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
NodeLoadMultipleTest::setUp in core/modules/node/tests/src/Kernel/NodeLoadMultipleTest.php
4 methods override NodeAccessTestBase::setUp()
NodeAccessLanguageAwareCombinationTest::setUp in core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php
NodeAccessLanguageAwareTest::setUp in core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php
NodeAccessLanguageTest::setUp in core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
NodeLoadMultipleTest::setUp in core/modules/node/tests/src/Kernel/NodeLoadMultipleTest.php

File

core/modules/node/tests/src/Kernel/NodeAccessTestBase.php, line 56

Class

NodeAccessTestBase
Defines a base class for node access kernel tests.

Namespace

Drupal\Tests\node\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installSchema('node', 'node_access');
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installConfig('filter');
    $this->installConfig('node');
    $this->accessHandler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
    // Clear permissions for authenticated users.
    $this->config('user.role.' . RoleInterface::AUTHENTICATED_ID)
        ->set('permissions', [])
        ->save();
    // Create user 1 who has special permissions.
    $this->drupalCreateUser();
    // Create a node type.
    $this->drupalCreateContentType([
        'type' => 'page',
        'name' => 'Basic page',
        'display_submitted' => FALSE,
    ]);
}

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