function CommentAnonymousTest::setUp

Same name and namespace in other branches
  1. 11.x core/modules/comment/tests/src/Functional/CommentAnonymousTest.php \Drupal\Tests\comment\Functional\CommentAnonymousTest::setUp()
  2. 10 core/modules/comment/tests/src/Functional/CommentAnonymousTest.php \Drupal\Tests\comment\Functional\CommentAnonymousTest::setUp()
  3. 9 core/modules/comment/tests/src/Functional/CommentAnonymousTest.php \Drupal\Tests\comment\Functional\CommentAnonymousTest::setUp()
  4. 8.9.x core/modules/comment/tests/src/Functional/CommentAnonymousTest.php \Drupal\Tests\comment\Functional\CommentAnonymousTest::setUp()

Overrides CommentTestBase::setUp

File

core/modules/comment/tests/src/Functional/CommentAnonymousTest.php, line 28

Class

CommentAnonymousTest
Tests anonymous commenting.

Namespace

Drupal\Tests\comment\Functional

Code

protected function setUp() : void {
  parent::setUp();
  // Enable anonymous and authenticated user comments.
  Role::loadOverrideFree(RoleInterface::ANONYMOUS_ID)->grantPermissions([
    'access comments',
    'post comments',
    'skip comment approval',
  ])
    ->save();
  Role::loadOverrideFree(RoleInterface::AUTHENTICATED_ID)->grantPermissions([
    'access comments',
    'post comments',
    'skip comment approval',
  ])
    ->save();
}

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