You are here

protected function CommentNodeAccessTest::setUp in Drupal 8

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

Overrides CommentTestBase::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() {
  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();
}