function CommentInterfaceTest::setUp

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

Set up comments to have subject and preview disabled.

Overrides CommentTestBase::setUp

File

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

Class

CommentInterfaceTest
Tests comment user interfaces.

Namespace

Drupal\Tests\comment\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $this->drupalLogin($this->adminUser);
    // Make sure that comment field title is not displayed when there's no
    // comments posted.
    $this->drupalGet($this->node
        ->toUrl());
    $this->assertSession()
        ->responseNotMatches('@<h2[^>]*>Comments</h2>@');
    // Set comments to have subject and preview disabled.
    $this->setCommentPreview(DRUPAL_DISABLED);
    $this->setCommentForm(TRUE);
    $this->setCommentSubject(FALSE);
    $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.');
    $this->drupalLogout();
}

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