From 06eed3052c7d6d9f25a538b9e954f14ea69a0331 Mon Sep 17 00:00:00 2001 From: catch Date: Fri, 25 May 2012 14:45:10 +0900 Subject: [PATCH] Issue #1480866 by tstoeckler, adamdicarlo, sheise: Follow-up for Add type-hinting and parameter type docmentation for comment objects. --- core/modules/comment/comment.pages.inc | 2 +- core/modules/comment/comment.test | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc index bac078b3ec7..0832eff0157 100644 --- a/core/modules/comment/comment.pages.inc +++ b/core/modules/comment/comment.pages.inc @@ -51,7 +51,7 @@ function comment_reply(Node $node, $pid = NULL) { if (user_access('access comments')) { // Load the parent comment. $comment = comment_load($pid); - if ($comment->status = COMMENT_PUBLISHED) { + if ($comment->status == COMMENT_PUBLISHED) { // If that comment exists, make sure that the current comment and the // parent comment both belong to the same parent node. if ($comment->nid != $node->nid) { diff --git a/core/modules/comment/comment.test b/core/modules/comment/comment.test index a791b2d599d..1ede06328f6 100644 --- a/core/modules/comment/comment.test +++ b/core/modules/comment/comment.test @@ -123,6 +123,12 @@ class CommentInterfaceTest extends CommentTestBase { $this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s')); $this->setCommentsPerPage(50); + // Attempt to reply to an unpublished comment. + $reply_loaded->status = COMMENT_NOT_PUBLISHED; + $reply_loaded->save(); + $this->drupalGet('comment/reply/' . $this->node->nid . '/' . $reply_loaded->cid); + $this->assertText(t('The comment you are replying to does not exist.'), 'Replying to an unpublished comment'); + // Attempt to post to node with comments disabled. $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_HIDDEN)); $this->assertTrue($this->node, t('Article node created.'));