summaryrefslogtreecommitdiff
path: root/modules/comment/comment.test
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2011-05-13 22:17:45 -0400
committerDries Buytaert <dries@buytaert.net>2011-05-13 22:17:45 -0400
commit33e746fc34ff2af303aca27b11c65a638bbc11a9 (patch)
tree82dd107bd295834f4e024dd2914484eb1e013f4b /modules/comment/comment.test
parent02dd3c52cd66cdc48aeab5834a163ff0321cefca (diff)
downloadbrdo-33e746fc34ff2af303aca27b11c65a638bbc11a9.tar.gz
brdo-33e746fc34ff2af303aca27b11c65a638bbc11a9.tar.bz2
- Patch #936844 by bleen18: cannot override comment author to or from Anonymous.
Diffstat (limited to 'modules/comment/comment.test')
-rw-r--r--modules/comment/comment.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/comment/comment.test b/modules/comment/comment.test
index 26e9b283e..770e01d4a 100644
--- a/modules/comment/comment.test
+++ b/modules/comment/comment.test
@@ -307,6 +307,26 @@ class CommentInterfaceTest extends CommentHelperCase {
$this->drupalLogin($this->admin_user);
$this->setCommentSubject(TRUE);
$this->setCommentPreview(DRUPAL_OPTIONAL);
+
+ // Test changing the comment author to "Anonymous".
+ $this->drupalGet('comment/' . $comment->id . '/edit');
+ $comment = $this->postComment(NULL, $comment->comment, $comment->subject, array('name' => ''));
+ $comment_loaded = comment_load($comment->id);
+ $this->assertTrue(empty($comment_loaded->name) && $comment_loaded->uid == 0, t('Comment author successfully changed to anonymous.'));
+
+ // Test changing the comment author to an unverified user.
+ $random_name = $this->randomName();
+ $this->drupalGet('comment/' . $comment->id . '/edit');
+ $comment = $this->postComment(NULL, $comment->comment, $comment->subject, array('name' => $random_name));
+ $this->drupalGet('node/' . $this->node->nid);
+ $this->assertText($random_name . ' (' . t('not verified') . ')', t('Comment author successfully changed to an unverified user.'));
+
+ // Test changing the comment author to a verified user.
+ $this->drupalGet('comment/' . $comment->id . '/edit');
+ $comment = $this->postComment(NULL, $comment->comment, $comment->subject, array('name' => $this->web_user->name));
+ $comment_loaded = comment_load($comment->id);
+ $this->assertTrue($comment_loaded->name == $this->web_user->name && $comment_loaded->uid == $this->web_user->uid, t('Comment author successfully changed to a registered user.'));
+
$this->drupalLogout();
// Reply to comment #2 creating comment #3 with optional preview and no