diff --git a/modules/comment/comment.module b/modules/comment/comment.module index b52204a..395bb63 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -2285,7 +2285,7 @@ function template_preprocess_comment(&$variables) { $variables['status'] = ($comment->status == COMMENT_NOT_PUBLISHED) ? 'comment-unpublished' : 'comment-published'; } // Gather comment classes. - if ($comment->uid === 0) { + if ($comment->uid == 0) { $variables['classes_array'][] = 'comment-by-anonymous'; } else { diff --git a/modules/comment/comment.test b/modules/comment/comment.test index e5cae5e..882c195 100644 --- a/modules/comment/comment.test +++ b/modules/comment/comment.test @@ -331,6 +331,8 @@ class CommentInterfaceTest extends CommentHelperCase { $comment = $this->postComment($this->node, $comment_text); $comment_loaded = comment_load($comment->id); $this->assertTrue($this->commentExists($comment), t('Comment found.')); + $by_viewer_class = $this->xpath('//div[contains(@class, "comment-by-viewer")]'); + $this->assertTrue(!empty($by_viewer_class), t('HTML class for comments by viewer found.')); // Set comments to have subject and preview to required. $this->drupalLogout(); @@ -417,6 +419,13 @@ class CommentInterfaceTest extends CommentHelperCase { $this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s')); $this->setCommentsPerPage(50); + // Create comment #5 to assert HTML class. + $this->drupalLogout(); + $this->drupalLogin($this->admin_user); + $comment = $this->postComment($this->node, $this->randomName(), $this->randomName()); + $by_node_author_class = $this->xpath('//div[contains(@class, "comment-by-node-author")]'); + $this->assertTrue(!empty($by_node_author_class), t('HTML class for node author found.')); + // 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.')); @@ -963,6 +972,8 @@ class CommentAnonymous extends CommentHelperCase { // Post anonymous comment without contact info. $anonymous_comment1 = $this->postComment($this->node, $this->randomName(), $this->randomName()); $this->assertTrue($this->commentExists($anonymous_comment1), t('Anonymous comment without contact info found.')); + $anonymous_class = $this->xpath('//div[contains(@class, "comment-by-anonymous")]'); + $this->assertTrue(!empty($anonymous_class), t('HTML class for anonymous comments found.')); // Allow contact info. $this->drupalLogin($this->admin_user);