You are here

protected function NodeAccessTest::setUp in Drupal 8

Same name in this branch
  1. 8 core/modules/content_moderation/tests/src/Functional/NodeAccessTest.php \Drupal\Tests\content_moderation\Functional\NodeAccessTest::setUp()
  2. 8 core/modules/content_moderation/tests/src/Kernel/NodeAccessTest.php \Drupal\Tests\content_moderation\Kernel\NodeAccessTest::setUp()
Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Functional/NodeAccessTest.php \Drupal\Tests\content_moderation\Functional\NodeAccessTest::setUp()

Sets the test up.

Overrides ModerationStateTestBase::setUp

File

core/modules/content_moderation/tests/src/Functional/NodeAccessTest.php, line 53

Class

NodeAccessTest
Tests permission access control around nodes.

Namespace

Drupal\Tests\content_moderation\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->createContentTypeFromUi('Moderated content', 'moderated_content', FALSE);
  $this
    ->grantUserPermissionToCreateContentOfType($this->adminUser, 'moderated_content');

  // Add the private field to the node type.
  node_access_test_add_field(NodeType::load('moderated_content'));

  // Rebuild permissions because hook_node_grants() is implemented by the
  // node_access_test_empty module.
  node_access_rebuild();
}