summaryrefslogtreecommitdiff
path: root/modules/comment
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-09-30 13:50:35 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-09-30 13:50:35 -0700
commit33c58e171cea3102098f0fb848ba406caf62dd1f (patch)
tree3e356878ac7f8098b19e3d2b16eb115a4a9f7e40 /modules/comment
parent18b96d0cda76abc603e4dc9f8e028c7274123d84 (diff)
downloadbrdo-33c58e171cea3102098f0fb848ba406caf62dd1f.tar.gz
brdo-33c58e171cea3102098f0fb848ba406caf62dd1f.tar.bz2
Issue #1110650 by oriol_e9g, JohnAlbin, linclark, dixon_: Fixed comment-by-anonymous class never appears.
Diffstat (limited to 'modules/comment')
-rw-r--r--modules/comment/comment.module2
-rw-r--r--modules/comment/comment.test9
2 files changed, 10 insertions, 1 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 4692d3313..99b0e2686 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -2288,7 +2288,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 c9478f491..f4e57c110 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('//a[@id=:comment_id]/following-sibling::div[1][contains(@class, "comment-by-viewer")]', array(':comment_id' => 'comment-' . $comment->id));
+ $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,11 @@ 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.
+ $comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
+ $by_node_author_class = $this->xpath('//a[@id=:comment_id]/following-sibling::div[1][contains(@class, "comment-by-node-author")]', array(':comment_id' => 'comment-' . $comment->id));
+ $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 +970,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('//a[@id=:comment_id]/following-sibling::div[1][contains(@class, "comment-by-anonymous")]', array(':comment_id' => 'comment-' . $anonymous_comment1->id));
+ $this->assertTrue(!empty($anonymous_class), t('HTML class for anonymous comments found.'));
// Allow contact info.
$this->drupalLogin($this->admin_user);