You are here

protected function BulkFormAccessTest::setUp in Drupal 10

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

Overrides NodeTestBase::setUp

File

core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php, line 48

Class

BulkFormAccessTest
Tests if entity access is respected on a node bulk operations form.

Namespace

Drupal\Tests\node\Functional\Views

Code

protected function setUp($import_test_views = TRUE, $modules = [
  'node_test_views',
]) : void {
  parent::setUp($import_test_views, $modules);

  // Create Article node type.
  $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
  ]);
  $this->accessHandler = \Drupal::entityTypeManager()
    ->getAccessControlHandler('node');
  node_access_test_add_field(NodeType::load('article'));

  // After enabling a node access module, the access table has to be rebuild.
  node_access_rebuild();

  // Enable the private node feature of the node_access_test module.
  \Drupal::state()
    ->set('node_access_test.private', TRUE);
}