function CommentTestBase::deleteComment

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

Deletes a comment.

Parameters

\Drupal\comment\CommentInterface $comment: Comment to delete.

1 call to CommentTestBase::deleteComment()
CommentInterfaceTest::testCommentInterface in core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
Tests the comment interface.

File

core/modules/comment/tests/src/Functional/CommentTestBase.php, line 232

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\Tests\comment\Functional

Code

public function deleteComment(CommentInterface $comment) {
    $this->drupalGet('comment/' . $comment->id() . '/delete');
    $this->submitForm([], 'Delete');
    $this->assertSession()
        ->pageTextContains('The comment and all its replies have been deleted.');
}

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