function CommentNodeAccessTest::setUp

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

Overrides CommentHelperCase::setUp

File

modules/comment/comment.test, line 1512

Class

CommentNodeAccessTest
Tests comments with node access.

Code

function setUp() {
    parent::setUp('search', 'node_access_test');
    node_access_rebuild();
    // Create users and test node.
    $this->admin_user = $this->drupalCreateUser(array(
        'administer content types',
        'administer comments',
        'administer blocks',
    ));
    $this->web_user = $this->drupalCreateUser(array(
        'access comments',
        'post comments',
        'create article content',
        'edit own comments',
        'node test view',
    ));
    $this->node = $this->drupalCreateNode(array(
        'type' => 'article',
        'promote' => 1,
        'uid' => $this->web_user->uid,
    ));
}

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