1.20.x comment.test CommentNodeChangesTestCase::testNodeDeletion()

Tests that comments are deleted with the node.

File

modules/comment/tests/comment.test, line 2218
Tests for the Comment module.

Class

CommentNodeChangesTestCase
Tests that comments behave correctly when the node is changed.

Code

function testNodeDeletion() {
  $this->backdropLogin($this->web_user);
  $comment = $this->postComment($this->node, $this->randomName(), '');
  $this->assertTrue(comment_load($comment->id), 'The comment could be loaded.');
  node_delete($this->node->nid);
  $this->assertFalse(comment_load($comment->id), 'The comment could not be loaded after the node was deleted.');
}