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. 10 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

3 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
3 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

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,
    ]);
}

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