You are here

protected function CommentNodeAccessTest::setUp in Drupal 10

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

File

core/modules/comment/tests/src/Functional/CommentNodeAccessTest.php, line 29

Class

CommentNodeAccessTest
Tests comments with node access.

Namespace

Drupal\Tests\comment\Functional

Code

protected function setUp() : void {
  parent::setUp();
  node_access_rebuild();

  // Re-create user.
  $this->webUser = $this
    ->drupalCreateUser([
    'access comments',
    'post comments',
    'create article content',
    'edit own comments',
    'node test view',
    'skip comment approval',
  ]);

  // Set the author of the created node to the web_user uid.
  $this->node
    ->setOwnerId($this->webUser
    ->id())
    ->save();
}