diff --git a/core/modules/comment/comment.test b/core/modules/comment/comment.test index 1fc8297..1fb2fd2 100644 --- a/core/modules/comment/comment.test +++ b/core/modules/comment/comment.test @@ -2220,3 +2220,27 @@ class CommentThreadingTestCase extends CommentHelperCase { $this->assertEqual($reply_loaded->thread, '02.01/'); } } + +/** + * Tests that comments behave correctly when the node is changed. + */ +class CommentNodeChangesTestCase extends CommentHelperCase { + + public static function getInfo() { + return array( + 'name' => 'Comment deletion on node changes', + 'description' => 'Tests that comments behave correctly when the node is changed.', + 'group' => 'Comment', + ); + } + + /** + * Tests that comments are deleted with the node. + */ + function testNodeDeletion() { + $comment = postComment($this->node, 'Test comment', 'Test'); + $this->assertTrue(comment_load($comment->cid), 'The comment could be loaded.'); + node_delete($this->node->nid); + $this->assertFalse(comment_load($comment->cid), 'The comment could not be loaded after the node was deleted.'); + } +}