You are here

protected function NodeAccessTestBase::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 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 55

Class

NodeAccessTestBase
Defines a base class for node access kernel tests.

Namespace

Drupal\Tests\node\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installSchema('system', 'sequences');
  $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,
  ]);
}