summaryrefslogtreecommitdiff
path: root/modules/comment/comment.test
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-08-05 23:53:39 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-08-05 23:53:39 +0000
commit25171a17f626695ecf984cc44b60d3eae1310b4c (patch)
tree3268ef89294cbb96d0875d665012c4ff16d8c68a /modules/comment/comment.test
parentcacd044a6398df92de68c5aea31987ac0fff507a (diff)
downloadbrdo-25171a17f626695ecf984cc44b60d3eae1310b4c.tar.gz
brdo-25171a17f626695ecf984cc44b60d3eae1310b4c.tar.bz2
Reverting #500866. Needs more discussion.
Diffstat (limited to 'modules/comment/comment.test')
-rw-r--r--modules/comment/comment.test260
1 files changed, 130 insertions, 130 deletions
diff --git a/modules/comment/comment.test b/modules/comment/comment.test
index 55882c234..54a39bf01 100644
--- a/modules/comment/comment.test
+++ b/modules/comment/comment.test
@@ -44,7 +44,7 @@ class CommentHelperCase extends DrupalWebTestCase {
$edit['subject'] = $subject;
}
else {
- $this->assertNoFieldByName('subject', '', 'Subject field not found.');
+ $this->assertNoFieldByName('subject', '', t('Subject field not found.'));
}
if ($contact !== NULL && is_array($contact)) {
@@ -53,19 +53,19 @@ class CommentHelperCase extends DrupalWebTestCase {
switch ($preview_mode) {
case DRUPAL_REQUIRED:
// Preview required so no save button should be found.
- $this->assertNoFieldByName('op', t('Save'), 'Save button not found.');
+ $this->assertNoFieldByName('op', t('Save'), t('Save button not found.'));
$this->drupalPost(NULL, $edit, t('Preview'));
// Don't break here so that we can test post-preview field presence and
// function below.
case DRUPAL_OPTIONAL:
- $this->assertFieldByName('op', t('Preview'), 'Preview button found.');
- $this->assertFieldByName('op', t('Save'), 'Save button found.');
+ $this->assertFieldByName('op', t('Preview'), t('Preview button found.'));
+ $this->assertFieldByName('op', t('Save'), t('Save button found.'));
$this->drupalPost(NULL, $edit, t('Save'));
break;
case DRUPAL_DISABLED:
- $this->assertNoFieldByName('op', t('Preview'), 'Preview button not found.');
- $this->assertFieldByName('op', t('Save'), 'Save button found.');
+ $this->assertNoFieldByName('op', t('Preview'), t('Preview button not found.'));
+ $this->assertFieldByName('op', t('Save'), t('Save button found.'));
$this->drupalPost(NULL, $edit, t('Save'));
break;
}
@@ -79,7 +79,7 @@ class CommentHelperCase extends DrupalWebTestCase {
$this->assertText($subject, 'Comment subject posted.');
}
$this->assertText($comment, 'Comment body posted.');
- $this->assertTrue((!empty($match) && !empty($match[1])), 'Comment id found.');
+ $this->assertTrue((!empty($match) && !empty($match[1])), t('Comment id found.'));
}
if (isset($match[1])) {
@@ -103,7 +103,7 @@ class CommentHelperCase extends DrupalWebTestCase {
$regex .= $comment->comment . '(.*?)'; // Match comment.
$regex .= '/s';
- return (boolean) preg_match($regex, $this->drupalGetContent());
+ return (boolean)preg_match($regex, $this->drupalGetContent());
}
else {
return FALSE;
@@ -118,7 +118,7 @@ class CommentHelperCase extends DrupalWebTestCase {
*/
function deleteComment($comment) {
$this->drupalPost('comment/' . $comment->id . '/delete', array(), t('Delete'));
- $this->assertText(t('The comment and all its replies have been deleted.'), 'Comment deleted.');
+ $this->assertText(t('The comment and all its replies have been deleted.'), t('Comment deleted.'));
}
/**
@@ -196,7 +196,7 @@ class CommentHelperCase extends DrupalWebTestCase {
*/
function setCommentSettings($name, $value, $message) {
variable_set($name . '_article', $value);
- $this->assertTrue(TRUE, $message); // Display status message.
+ $this->assertTrue(TRUE, t($message)); // Display status message.
}
/**
@@ -226,10 +226,10 @@ class CommentHelperCase extends DrupalWebTestCase {
if ($operation == 'delete') {
$this->drupalPost(NULL, array(), t('Delete comments'));
- $this->assertRaw(t('Deleted @count comments.', array('@count' => 1)), 'Operation "' . $operation . '" was performed on comment.');
+ $this->assertRaw(t('Deleted @count comments.', array('@count' => 1)), t('Operation "' . $operation . '" was performed on comment.'));
}
else {
- $this->assertText(t('The update has been performed.'), 'Operation "' . $operation . '" was performed on comment.');
+ $this->assertText(t('The update has been performed.'), t('Operation "' . $operation . '" was performed on comment.'));
}
}
@@ -276,7 +276,7 @@ class CommentInterfaceTest extends CommentHelperCase {
$comment_text = $this->randomName();
$comment = $this->postComment($this->node, $comment_text);
$comment_loaded = comment_load($comment->id);
- $this->assertTrue($this->commentExists($comment), 'Comment found.');
+ $this->assertTrue($this->commentExists($comment), t('Comment found.'));
// Set comments to have subject and preview to required.
$this->drupalLogout();
@@ -291,12 +291,12 @@ class CommentInterfaceTest extends CommentHelperCase {
$comment_text = $this->randomName();
$comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
$comment_loaded = comment_load($comment->id);
- $this->assertTrue($this->commentExists($comment), 'Comment found.');
+ $this->assertTrue($this->commentExists($comment), t('Comment found.'));
// Check comment display.
$this->drupalGet('node/' . $this->node->nid . '/' . $comment->id);
- $this->assertText($subject_text, 'Individual comment subject found.');
- $this->assertText($comment_text, 'Individual comment body found.');
+ $this->assertText($subject_text, t('Individual comment subject found.'));
+ $this->assertText($comment_text, t('Individual comment body found.'));
// Set comments to have subject and preview to optional.
$this->drupalLogout();
@@ -309,60 +309,60 @@ class CommentInterfaceTest extends CommentHelperCase {
// subject though field enabled.
$this->drupalLogin($this->web_user);
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
- $this->assertText($subject_text, 'Individual comment-reply subject found.');
- $this->assertText($comment_text, 'Individual comment-reply body found.');
+ $this->assertText($subject_text, t('Individual comment-reply subject found.'));
+ $this->assertText($comment_text, t('Individual comment-reply body found.'));
$reply = $this->postComment(NULL, $this->randomName(), '', TRUE);
$reply_loaded = comment_load($reply->id);
- $this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
- $this->assertEqual($comment->id, $reply_loaded->pid, 'Pid of a reply to a comment is set correctly.');
- $this->assertEqual(rtrim($comment_loaded->thread, '/') . '.00/', $reply_loaded->thread, 'Thread of reply grows correctly.');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('Reply found.'));
+ $this->assertEqual($comment->id, $reply_loaded->pid, t('Pid of a reply to a comment is set correctly.'));
+ $this->assertEqual(rtrim($comment_loaded->thread, '/') . '.00/', $reply_loaded->thread, t('Thread of reply grows correctly.'));
// Second reply to comment #3 creating comment #4.
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
- $this->assertText($subject_text, 'Individual comment-reply subject found.');
- $this->assertText($comment_text, 'Individual comment-reply body found.');
+ $this->assertText($subject_text, t('Individual comment-reply subject found.'));
+ $this->assertText($comment_text, t('Individual comment-reply body found.'));
$reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
$reply_loaded = comment_load($reply->id);
- $this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
- $this->assertEqual(rtrim($comment_loaded->thread, '/') . '.01/', $reply_loaded->thread, 'Thread of second reply grows correctly.');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('Second reply found.'));
+ $this->assertEqual(rtrim($comment_loaded->thread, '/') . '.01/', $reply_loaded->thread, t('Thread of second reply grows correctly.'));
// Edit reply.
$this->drupalGet('comment/' . $reply->id . '/edit');
$reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
- $this->assertTrue($this->commentExists($reply, TRUE), 'Modified reply found.');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('Modified reply found.'));
// Correct link count
$this->drupalGet('node');
- $this->assertRaw('4 comments', 'Link to the 4 comments exist.');
+ $this->assertRaw('4 comments', t('Link to the 4 comments exist.'));
// Confirm a new comment is posted to the correct page.
$this->setCommentsPerPage(2);
$comment_new_page = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
- $this->assertTrue($this->commentExists($comment_new_page), 'Page one exists. %s');
+ $this->assertTrue($this->commentExists($comment_new_page), t('Page one exists. %s'));
$this->drupalGet('node/' . $this->node->nid, array('query' => array('page' => 1)));
- $this->assertTrue($this->commentExists($reply, TRUE), 'Page two exists. %s');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s'));
$this->setCommentsPerPage(50);
// 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, 'Article node created.');
+ $this->assertTrue($this->node, t('Article node created.'));
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertText('This discussion is closed', 'Posting to node with comments disabled');
- $this->assertNoField('edit-comment', 'Comment body field found.');
+ $this->assertText('This discussion is closed', t('Posting to node with comments disabled'));
+ $this->assertNoField('edit-comment', t('Comment body field found.'));
// Attempt to post to node with read-only comments.
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_CLOSED));
- $this->assertTrue($this->node, 'Article node created.');
+ $this->assertTrue($this->node, t('Article node created.'));
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertText('This discussion is closed', 'Posting to node with comments read-only');
- $this->assertNoField('edit-comment', 'Comment body field found.');
+ $this->assertText('This discussion is closed', t('Posting to node with comments read-only'));
+ $this->assertNoField('edit-comment', t('Comment body field found.'));
// Attempt to post to node with comments enabled (check field names etc).
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_OPEN));
- $this->assertTrue($this->node, 'Article node created.');
+ $this->assertTrue($this->node, t('Article node created.'));
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertNoText('This discussion is closed', 'Posting to node with comments enabled');
- $this->assertField('edit-comment-body-' . $langcode . '-0-value', 'Comment body field found.');
+ $this->assertNoText('This discussion is closed', t('Posting to node with comments enabled'));
+ $this->assertField('edit-comment-body-' . $langcode . '-0-value', t('Comment body field found.'));
// Delete comment and make sure that reply is also removed.
$this->drupalLogout();
@@ -371,8 +371,8 @@ class CommentInterfaceTest extends CommentHelperCase {
$this->deleteComment($comment_new_page);
$this->drupalGet('node/' . $this->node->nid);
- $this->assertFalse($this->commentExists($comment), 'Comment not found.');
- $this->assertFalse($this->commentExists($reply, TRUE), 'Reply not found.');
+ $this->assertFalse($this->commentExists($comment), t('Comment not found.'));
+ $this->assertFalse($this->commentExists($reply, TRUE), t('Reply not found.'));
// Enabled comment form on node page.
$this->drupalLogin($this->admin_user);
@@ -383,7 +383,7 @@ class CommentInterfaceTest extends CommentHelperCase {
$this->drupalLogin($this->web_user);
$this->drupalGet('node/' . $this->node->nid);
$form_comment = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
- $this->assertTrue($this->commentExists($form_comment), 'Form comment found.');
+ $this->assertTrue($this->commentExists($form_comment), t('Form comment found.'));
// Disable comment form on node page.
$this->drupalLogout();
@@ -426,13 +426,13 @@ class CommentPreviewTest extends CommentHelperCase {
$this->drupalPost('node/' . $this->node->nid, $edit, t('Preview'));
// Check that the preview is displaying the title and body.
- $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
- $this->assertText($edit['subject'], 'Subject displayed.');
- $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], 'Comment displayed.');
+ $this->assertTitle(t('Preview comment | Drupal'), t('Page title is "Preview comment".'));
+ $this->assertText($edit['subject'], t('Subject displayed.'));
+ $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], t('Comment displayed.'));
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
- $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
+ $this->assertFieldByName('subject', $edit['subject'], t('Subject field displayed.'));
+ $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], t('Comment field displayed.'));
}
/**
@@ -457,17 +457,17 @@ class CommentPreviewTest extends CommentHelperCase {
$this->drupalPost('comment/' . $comment->id . '/edit', $edit, t('Preview'));
// Check that the preview is displaying the subject, comment, author and date correctly.
- $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
- $this->assertText($edit['subject'], 'Subject displayed.');
- $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], 'Comment displayed.');
- $this->assertText($edit['name'], 'Author displayed.');
- $this->assertText($expected_date, 'Date displayed.');
+ $this->assertTitle(t('Preview comment | Drupal'), t('Page title is "Preview comment".'));
+ $this->assertText($edit['subject'], t('Subject displayed.'));
+ $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], t('Comment displayed.'));
+ $this->assertText($edit['name'], t('Author displayed.'));
+ $this->assertText($expected_date, t('Date displayed.'));
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
- $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
- $this->assertFieldByName('name', $edit['name'], 'Author field displayed.');
- $this->assertFieldByName('date', $edit['date'], 'Date field displayed.');
+ $this->assertFieldByName('subject', $edit['subject'], t('Subject field displayed.'));
+ $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], t('Comment field displayed.'));
+ $this->assertFieldByName('name', $edit['name'], t('Author field displayed.'));
+ $this->assertFieldByName('date', $edit['date'], t('Date field displayed.'));
}
}
@@ -502,7 +502,7 @@ 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), 'Anonymous comment without contact info found.');
+ $this->assertTrue($this->commentExists($anonymous_comment1), t('Anonymous comment without contact info found.'));
// Allow contact info.
$this->drupalLogin($this->admin_user);
@@ -511,15 +511,15 @@ class CommentAnonymous extends CommentHelperCase {
// Attempt to edit anonymous comment.
$this->drupalGet('comment/' . $anonymous_comment1->id . '/edit');
$edited_comment = $this->postComment(NULL, $this->randomName(), $this->randomName());
- $this->assertTrue($this->commentExists($edited_comment, FALSE), 'Modified reply found.');
+ $this->assertTrue($this->commentExists($edited_comment, FALSE), t('Modified reply found.'));
$this->drupalLogout();
// Post anonymous comment with contact info (optional).
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
+ $this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.'));
$anonymous_comment2 = $this->postComment($this->node, $this->randomName(), $this->randomName());
- $this->assertTrue($this->commentExists($anonymous_comment2), 'Anonymous comment with contact info (optional) found.');
+ $this->assertTrue($this->commentExists($anonymous_comment2), t('Anonymous comment with contact info (optional) found.'));
// Require contact info.
$this->drupalLogin($this->admin_user);
@@ -528,41 +528,41 @@ class CommentAnonymous extends CommentHelperCase {
// Try to post comment with contact info (required).
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
+ $this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.'));
$anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
- $this->assertText(t('E-mail field is required.'), 'E-mail required.'); // Name should have 'Anonymous' for value by default.
- $this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.');
+ $this->assertText(t('E-mail field is required.'), t('E-mail required.')); // Name should have 'Anonymous' for value by default.
+ $this->assertFalse($this->commentExists($anonymous_comment3), t('Anonymous comment with contact info (required) not found.'));
// Post comment with contact info (required).
$author_name = $this->randomName();
$author_mail = $this->randomName() . '@example.com';
$anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), array('name' => $author_name, 'mail' => $author_mail));
- $this->assertTrue($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) found.');
+ $this->assertTrue($this->commentExists($anonymous_comment3), t('Anonymous comment with contact info (required) found.'));
// Make sure the user data appears correctly when editing the comment.
$this->drupalLogin($this->admin_user);
$this->drupalGet('comment/' . $anonymous_comment3->id . '/edit');
- $this->assertRaw($author_name, "The anonymous user's name is correct when editing the comment.");
- $this->assertRaw($author_mail, "The anonymous user's e-mail address is correct when editing the comment.");
+ $this->assertRaw($author_name, t("The anonymous user's name is correct when editing the comment."));
+ $this->assertRaw($author_mail, t("The anonymous user's e-mail address is correct when editing the comment."));
// Unpublish comment.
$this->performCommentOperation($anonymous_comment3, 'unpublish');
$this->drupalGet('admin/content/comment/approval');
- $this->assertRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was unpublished.');
+ $this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was unpublished.'));
// Publish comment.
$this->performCommentOperation($anonymous_comment3, 'publish', TRUE);
$this->drupalGet('admin/content/comment');
- $this->assertRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was published.');
+ $this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was published.'));
// Delete comment.
$this->performCommentOperation($anonymous_comment3, 'delete');
$this->drupalGet('admin/content/comment');
- $this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was deleted.');
+ $this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was deleted.'));
$this->drupalLogout();
// Reset.
@@ -576,14 +576,14 @@ class CommentAnonymous extends CommentHelperCase {
// NOTE: if authenticated user has permission to post comments, then a
// "Login or register to post comments" type link may be shown.
$this->drupalGet('node/' . $this->node->nid);
- $this->assertNoPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', 'Comments were not displayed.');
- $this->assertNoLink('Add new comment', 'Link to add comment was found.');
+ $this->assertNoPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', t('Comments were not displayed.'));
+ $this->assertNoLink('Add new comment', t('Link to add comment was found.'));
// Attempt to view node-comment form while disallowed.
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertText('You are not authorized to view comments', 'Error attempting to post comment.');
- $this->assertNoFieldByName('subject', '', 'Subject field not found.');
- $this->assertNoFieldByName('comment[value]', '', 'Comment field not found.');
+ $this->assertText('You are not authorized to view comments', t('Error attempting to post comment.'));
+ $this->assertNoFieldByName('subject', '', t('Subject field not found.'));
+ $this->assertNoFieldByName('comment[value]', '', t('Comment field not found.'));
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
@@ -591,9 +591,9 @@ class CommentAnonymous extends CommentHelperCase {
'post comments without approval' => FALSE,
));
$this->drupalGet('node/' . $this->node->nid);
- $this->assertPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', 'Comments were displayed.');
- $this->assertLink('Log in', 1, 'Link to log in was found.');
- $this->assertLink('register', 1, 'Link to register was found.');
+ $this->assertPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', t('Comments were displayed.'));
+ $this->assertLink('Log in', 1, t('Link to log in was found.'));
+ $this->assertLink('register', 1, t('Link to register was found.'));
}
}
@@ -637,22 +637,22 @@ class CommentPagerTest extends CommentHelperCase {
// Check the first page of the node, and confirm the correct comments are
// shown.
$this->drupalGet('node/' . $node->nid);
- $this->assertRaw(t('next'), 'Paging links found.');
- $this->assertTrue($this->commentExists($comments[0]), 'Comment 1 appears on page 1.');
- $this->assertFalse($this->commentExists($comments[1]), 'Comment 2 does not appear on page 1.');
- $this->assertFalse($this->commentExists($comments[2]), 'Comment 3 does not appear on page 1.');
+ $this->assertRaw(t('next'), t('Paging links found.'));
+ $this->assertTrue($this->commentExists($comments[0]), t('Comment 1 appears on page 1.'));
+ $this->assertFalse($this->commentExists($comments[1]), t('Comment 2 does not appear on page 1.'));
+ $this->assertFalse($this->commentExists($comments[2]), t('Comment 3 does not appear on page 1.'));
// Check the second page.
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 1)));
- $this->assertTrue($this->commentExists($comments[1]), 'Comment 2 appears on page 2.');
- $this->assertFalse($this->commentExists($comments[0]), 'Comment 1 does not appear on page 2.');
- $this->assertFalse($this->commentExists($comments[2]), 'Comment 3 does not appear on page 2.');
+ $this->assertTrue($this->commentExists($comments[1]), t('Comment 2 appears on page 2.'));
+ $this->assertFalse($this->commentExists($comments[0]), t('Comment 1 does not appear on page 2.'));
+ $this->assertFalse($this->commentExists($comments[2]), t('Comment 3 does not appear on page 2.'));
// Check the third page.
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 2)));
- $this->assertTrue($this->commentExists($comments[2]), 'Comment 3 appears on page 3.');
- $this->assertFalse($this->commentExists($comments[0]), 'Comment 1 does not appear on page 3.');
- $this->assertFalse($this->commentExists($comments[1]), 'Comment 2 does not appear on page 3.');
+ $this->assertTrue($this->commentExists($comments[2]), t('Comment 3 appears on page 3.'));
+ $this->assertFalse($this->commentExists($comments[0]), t('Comment 1 does not appear on page 3.'));
+ $this->assertFalse($this->commentExists($comments[1]), t('Comment 2 does not appear on page 3.'));
// Post a reply to the oldest comment and test again.
$replies = array();
@@ -664,21 +664,21 @@ class CommentPagerTest extends CommentHelperCase {
// We are still in flat view - the replies should not be on the first page,
// even though they are replies to the oldest comment.
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 0)));
- $this->assertFalse($this->commentExists($reply, TRUE), 'In flat mode, reply does not appear on page 1.');
+ $this->assertFalse($this->commentExists($reply, TRUE), t('In flat mode, reply does not appear on page 1.'));
// If we switch to threaded mode, the replies on the oldest comment
// should be bumped to the first page and comment 6 should be bumped
// to the second page.
$this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, t('Switched to threaded mode.'));
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 0)));
- $this->assertTrue($this->commentExists($reply, TRUE), 'In threaded mode, reply appears on page 1.');
- $this->assertFalse($this->commentExists($comments[1]), 'In threaded mode, comment 2 has been bumped off of page 1.');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('In threaded mode, reply appears on page 1.'));
+ $this->assertFalse($this->commentExists($comments[1]), t('In threaded mode, comment 2 has been bumped off of page 1.'));
// If (# replies > # comments per page) in threaded expanded view,
// the overage should be bumped.
$reply2 = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 0)));
- $this->assertFalse($this->commentExists($reply2, TRUE), 'In threaded mode where # replies > # comments per page, the newest reply does not appear on page 1.');
+ $this->assertFalse($this->commentExists($reply2, TRUE), t('In threaded mode where # replies > # comments per page, the newest reply does not appear on page 1.'));
$this->drupalLogout();
}
@@ -780,7 +780,7 @@ class CommentPagerTest extends CommentHelperCase {
$result_order[] = substr($anchor['id'], 8);
}
- return $this->assertIdentical($expected_cids, $result_order, 'Comment order: expected ' . implode(',', $expected_cids) . ', returned ' . implode(',', $result_order) . '.');
+ return $this->assertIdentical($expected_cids, $result_order, t('Comment order: expected @expected, returned @returned.', array('@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order))));
}
/**
@@ -840,7 +840,7 @@ class CommentPagerTest extends CommentHelperCase {
foreach ($expected_pages as $new_replies => $expected_page) {
$returned = comment_new_page_count($node->comment_count, $new_replies, $node);
$returned_page = is_array($returned) ? $returned['page'] : 0;
- $this->assertIdentical($expected_page, $returned_page, 'Flat mode, ' . $new_replies . ' replies: expected page ' . $expected_page . ', returned page ' . $returned_page . '.');
+ $this->assertIdentical($expected_page, $returned_page, t('Flat mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
}
$this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, t('Switched to threaded mode.'));
@@ -858,7 +858,7 @@ class CommentPagerTest extends CommentHelperCase {
foreach ($expected_pages as $new_replies => $expected_page) {
$returned = comment_new_page_count($node->comment_count, $new_replies, $node);
$returned_page = is_array($returned) ? $returned['page'] : 0;
- $this->assertEqual($expected_page, $returned_page, 'Threaded mode, ' . $new_replies . ' replies: expected page ' . $expected_page . ', returned page ' . $returned_page . '.');
+ $this->assertEqual($expected_page, $returned_page, t('Threaded mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
}
}
}
@@ -895,7 +895,7 @@ class CommentApprovalTest extends CommentHelperCase {
$subject = $this->randomName();
$body = $this->randomName();
$this->postComment($this->node, $body, $subject, TRUE); // Set $contact to true so that it won't check for id and message.
- $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+ $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), t('Comment requires approval.'));
// Get unapproved comment id.
$this->drupalLogin($this->admin_user);
@@ -903,7 +903,7 @@ class CommentApprovalTest extends CommentHelperCase {
$anonymous_comment4 = (object) array('id' => $anonymous_comment4, 'subject' => $subject, 'comment' => $body);
$this->drupalLogout();
- $this->assertFalse($this->commentExists($anonymous_comment4), 'Anonymous comment was not published.');
+ $this->assertFalse($this->commentExists($anonymous_comment4), t('Anonymous comment was not published.'));
// Approve comment.
$this->drupalLogin($this->admin_user);
@@ -911,7 +911,7 @@ class CommentApprovalTest extends CommentHelperCase {
$this->drupalLogout();
$this->drupalGet('node/' . $this->node->nid);
- $this->assertTrue($this->commentExists($anonymous_comment4), 'Anonymous comment visible.');
+ $this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.'));
// Post 2 anonymous comments without contact info.
$comments[] = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
@@ -920,13 +920,13 @@ class CommentApprovalTest extends CommentHelperCase {
// Publish multiple comments in one operation.
$this->drupalLogin($this->admin_user);
$this->drupalGet('admin/content/comment/approval');
- $this->assertText(t('Unapproved comments (@count)', array('@count' => 2)), 'Two unapproved comments waiting for approval.');
+ $this->assertText(t('Unapproved comments (@count)', array('@count' => 2)), t('Two unapproved comments waiting for approval.'));
$edit = array(
"comments[{$comments[0]->id}]" => 1,
"comments[{$comments[1]->id}]" => 1,
);
$this->drupalPost(NULL, $edit, t('Update'));
- $this->assertText(t('Unapproved comments (@count)', array('@count' => 0)), 'All comments were approved.');
+ $this->assertText(t('Unapproved comments (@count)', array('@count' => 0)), t('All comments were approved.'));
// Delete multiple comments in one operation.
$edit = array(
@@ -936,9 +936,9 @@ class CommentApprovalTest extends CommentHelperCase {
"comments[{$anonymous_comment4->id}]" => 1,
);
$this->drupalPost(NULL, $edit, t('Update'));
- $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
+ $this->assertText(t('Are you sure you want to delete these comments and all their children?'), t('Confirmation required.'));
$this->drupalPost(NULL, $edit, t('Delete comments'));
- $this->assertText(t('No comments available.'), 'All comments were deleted.');
+ $this->assertText(t('No comments available.'), t('All comments were deleted.'));
}
/**
@@ -959,7 +959,7 @@ class CommentApprovalTest extends CommentHelperCase {
$subject = $this->randomName();
$body = $this->randomName();
$this->postComment($this->node, $body, $subject, TRUE); // Set $contact to true so that it won't check for id and message.
- $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+ $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), t('Comment requires approval.'));
// Get unapproved comment id.
$this->drupalLogin($this->admin_user);
@@ -967,20 +967,20 @@ class CommentApprovalTest extends CommentHelperCase {
$anonymous_comment4 = (object) array('id' => $anonymous_comment4, 'subject' => $subject, 'comment' => $body);
$this->drupalLogout();
- $this->assertFalse($this->commentExists($anonymous_comment4), 'Anonymous comment was not published.');
+ $this->assertFalse($this->commentExists($anonymous_comment4), t('Anonymous comment was not published.'));
// Approve comment.
$this->drupalLogin($this->admin_user);
$this->drupalGet('comment/1/approve');
- $this->assertResponse(403, 'Forged comment approval was denied.');
+ $this->assertResponse(403, t('Forged comment approval was denied.'));
$this->drupalGet('comment/1/approve', array('query' => array('token' => 'forged')));
- $this->assertResponse(403, 'Forged comment approval was denied.');
+ $this->assertResponse(403, t('Forged comment approval was denied.'));
$this->drupalGet('node/' . $this->node->nid);
$this->clickLink(t('approve'));
$this->drupalLogout();
$this->drupalGet('node/' . $this->node->nid);
- $this->assertTrue($this->commentExists($anonymous_comment4), 'Anonymous comment visible.');
+ $this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.'));
}
}
@@ -1007,7 +1007,7 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
'comment_recent[region]' => 'sidebar_first',
);
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block saved to first sidebar region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block saved to first sidebar region.'));
// Set block title and variables.
$block = array(
@@ -1015,7 +1015,7 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
'comment_block_count' => 2,
);
$this->drupalPost('admin/structure/block/manage/comment/recent/configure', $block, t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block saved.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
// Add some test comments, one without a subject.
$comment1 = $this->postComment($this->node, $this->randomName(), $this->randomName());
@@ -1027,20 +1027,20 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
$this->drupalLogout();
user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access comments'));
$this->drupalGet('');
- $this->assertNoText($block['title'], 'Block was not found.');
+ $this->assertNoText($block['title'], t('Block was not found.'));
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access comments'));
// Test that a user with the 'access comments' permission can see the
// block.
$this->drupalLogin($this->web_user);
$this->drupalGet('');
- $this->assertText($block['title'], 'Block was found.');
+ $this->assertText($block['title'], t('Block was found.'));
// Test the only the 2 latest comments are shown and in the proper order.
- $this->assertNoText($comment1->subject, 'Comment not found in block.');
- $this->assertText($comment2->subject, 'Comment found in block.');
- $this->assertText($comment3->comment, 'Comment found in block.');
- $this->assertTrue(strpos($this->drupalGetContent(), $comment3->comment) < strpos($this->drupalGetContent(), $comment2->subject), 'Comments were ordered correctly in block.');
+ $this->assertNoText($comment1->subject, t('Comment not found in block.'));
+ $this->assertText($comment2->subject, t('Comment found in block.'));
+ $this->assertText($comment3->comment, t('Comment found in block.'));
+ $this->assertTrue(strpos($this->drupalGetContent(), $comment3->comment) < strpos($this->drupalGetContent(), $comment2->subject), t('Comments were ordered correctly in block.'));
// Set the number of recent comments to show to 10.
$this->drupalLogout();
@@ -1049,30 +1049,30 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
'comment_block_count' => 10,
);
$this->drupalPost('admin/structure/block/manage/comment/recent/configure', $block, t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block saved.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
// Post an additional comment.
$comment4 = $this->postComment($this->node, $this->randomName(), $this->randomName());
// Test that all four comments are shown.
- $this->assertText($comment1->subject, 'Comment found in block.');
- $this->assertText($comment2->subject, 'Comment found in block.');
- $this->assertText($comment3->comment, 'Comment found in block.');
- $this->assertText($comment4->subject, 'Comment found in block.');
+ $this->assertText($comment1->subject, t('Comment found in block.'));
+ $this->assertText($comment2->subject, t('Comment found in block.'));
+ $this->assertText($comment3->comment, t('Comment found in block.'));
+ $this->assertText($comment4->subject, t('Comment found in block.'));
// Test that links to comments work when comments are across pages.
$this->setCommentsPerPage(1);
$this->drupalGet('');
$this->clickLink($comment1->subject);
- $this->assertText($comment1->subject, 'Comment link goes to correct page.');
+ $this->assertText($comment1->subject, t('Comment link goes to correct page.'));
$this->drupalGet('');
$this->clickLink($comment2->subject);
- $this->assertText($comment2->subject, 'Comment link goes to correct page.');
+ $this->assertText($comment2->subject, t('Comment link goes to correct page.'));
$this->clickLink($comment4->subject);
- $this->assertText($comment4->subject, 'Comment link goes to correct page.');
+ $this->assertText($comment4->subject, t('Comment link goes to correct page.'));
// Check that when viewing a comment page from a link to the comment, that
// rel="canonical" is added to the head of the document.
- $this->assertRaw('<link rel="canonical"', 'Canonical URL was found in the HTML head');
+ $this->assertRaw('<link rel="canonical"', t('Canonical URL was found in the HTML head'));
}
}
@@ -1097,13 +1097,13 @@ class CommentRSSUnitTest extends CommentHelperCase {
$comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
$this->drupalGet('rss.xml');
$raw = '<comments>' . url('node/' . $this->node->nid, array('fragment' => 'comments', 'absolute' => TRUE)) . '</comments>';
- $this->assertRaw($raw, 'Comments as part of RSS feed.');
+ $this->assertRaw($raw, t('Comments as part of RSS feed.'));
// Hide comments from RSS feed and check presence.
$this->node->comment = COMMENT_NODE_HIDDEN;
node_save($this->node);
$this->drupalGet('rss.xml');
- $this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.');
+ $this->assertNoRaw($raw, t('Hidden comments is not a part of RSS feed.'));
}
}
@@ -1137,14 +1137,14 @@ class CommentContentRebuild extends CommentHelperCase {
$comment_text = $this->randomName();
$comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
$comment_loaded = comment_load($comment->id);
- $this->assertTrue($this->commentExists($comment), 'Comment found.');
+ $this->assertTrue($this->commentExists($comment), t('Comment found.'));
// Add the property to the content array and then see if it still exists on build.
$comment_loaded->content['test_property'] = array('#value' => $this->randomString());
$built_content = comment_view($comment_loaded, $this->node);
// This means that the content was rebuilt as the added test property no longer exists.
- $this->assertFalse(isset($built_content['test_property']), 'Comment content was emptied before being built.');
+ $this->assertFalse(isset($built_content['test_property']), t('Comment content was emptied before being built.'));
}
}
@@ -1210,11 +1210,11 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
$tests['[comment:author:name]'] = check_plain($this->admin_user->name);
// Test to make sure that we generated something for each token.
- $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('comment' => $comment), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized comment token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized comment token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -1230,7 +1230,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('comment' => $comment), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), 'Unsanitized comment token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Unsanitized comment token %token replaced.', array('%token' => $input)));
}
// Load node so comment_count gets computed.
@@ -1243,7 +1243,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Node comment token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Node comment token %token replaced.', array('%token' => $input)));
}
}
}