function CommentThreadingTest::testCommentReplyLinkUnpublished
Same name in other branches
- 11.x core/modules/comment/tests/src/Functional/CommentThreadingTest.php \Drupal\Tests\comment\Functional\CommentThreadingTest::testCommentReplyLinkUnpublished()
Check the reply link on unpublished comments.
File
-
core/
modules/ comment/ tests/ src/ Functional/ CommentThreadingTest.php, line 24
Class
- CommentThreadingTest
- Tests to make sure the comment number increments properly.
Namespace
Drupal\Tests\comment\FunctionalCode
public function testCommentReplyLinkUnpublished() : void {
// Set comments to have a subject with preview disabled.
$this->setCommentPreview(DRUPAL_DISABLED);
$this->setCommentForm(FALSE);
$this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.');
// Create a node.
$this->drupalLogin($this->adminUser);
$this->node = $this->drupalCreateNode([
'type' => 'article',
'promote' => 1,
'uid' => $this->webUser
->id(),
]);
// Post comment #1.
$comment_text = $this->randomMachineName();
$comment1 = $this->postComment($this->node, $comment_text, '', TRUE);
$this->drupalGet($this->node
->toUrl());
$this->assertSession()
->pageTextContains('Reply');
$comment1->setUnpublished();
$comment1->save();
$this->drupalGet($this->node
->toUrl());
$this->assertSession()
->pageTextNotContains('Reply');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.