1 comment.test | public CommentAuthorDeletionTestCase::testAuthorDeletionCommentModuleDisabled() |
Test comment author deletion while the comment module is disabled.
File
- core/
modules/ comment/ tests/ comment.test, line 2409 - Tests for the Comment module.
Class
- CommentAuthorDeletionTestCase
- Tests the behavior of comments when the comment author is deleted.
Code
public function testAuthorDeletionCommentModuleDisabled() {
// Create a comment as the admin user.
$this->backdropLogin($this->admin_user);
$comment = $this->postComment($this->node, $this->randomName());
$this->assertTrue($this->commentExists($comment), t('Comment is displayed initially.'));
$this->backdropLogout();
// Delete the admin user while the comment module is disabled, and ensure
// that the missing comment author is still handled correctly (the node
// itself should be displayed, but the comment should not be displayed on
// it).
module_disable(array('comment'));
user_delete($this->admin_user->uid);
cache('entity_comment')->flush();
module_enable(array('comment'));
$this->backdropGet('node/' . $this->node->nid);
$this->assertResponse(200, t('Node page is accessible after the comment author is deleted.'));
$this->assertFalse($this->commentExists($comment), t('Comment is not displayed after the comment author is deleted.'));
}