Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.920
diff -u -p -r1.920 comment.module
--- modules/comment/comment.module	23 Nov 2010 06:02:06 -0000	1.920
+++ modules/comment/comment.module	28 Nov 2010 03:10:53 -0000
@@ -596,15 +596,13 @@ function theme_comment_block() {
 function comment_node_view($node, $view_mode) {
   $links = array();
 
-  if ($node->comment) {
+  if ($node->comment != COMMENT_NODE_HIDDEN) {
     if ($view_mode == 'rss') {
-      if ($node->comment != COMMENT_NODE_HIDDEN) {
-        // Add a comments RSS element which is a URL to the comments of this node.
-        $node->rss_elements[] = array(
-          'key' => 'comments',
-          'value' => url('node/' . $node->nid, array('fragment' => 'comments', 'absolute' => TRUE))
-        );
-      }
+      // Add a comments RSS element which is a URL to the comments of this node.
+      $node->rss_elements[] = array(
+        'key' => 'comments',
+        'value' => url('node/' . $node->nid, array('fragment' => 'comments', 'absolute' => TRUE))
+      );
     }
     elseif ($view_mode == 'teaser') {
       // Teaser view: display the number of comments that have been posted,
@@ -619,9 +617,8 @@ function comment_node_view($node, $view_
             'fragment' => 'comments',
             'html' => TRUE,
           );
-
-          $new = comment_num_new($node->nid);
-          if ($new) {
+          // Show a link to the first new comment.
+          if ($new = comment_num_new($node->nid)) {
             $links['comment-new-comments'] = array(
               'title' => format_plural($new, '1 new comment', '@count new comments'),
               'href' => "node/$node->nid",
@@ -632,21 +629,22 @@ function comment_node_view($node, $view_
             );
           }
         }
+      }
+      if ($node->comment == COMMENT_NODE_OPEN) {
+        if (user_access('post comments')) {
+          $links['comment-add'] = array(
+            'title' => t('Add new comment'),
+            'href' => "comment/reply/$node->nid",
+            'attributes' => array('title' => t('Add a new comment to this page.')),
+            'fragment' => 'comment-form',
+            'html' => TRUE,
+          );
+        }
         else {
-          if ($node->comment == COMMENT_NODE_OPEN) {
-            if (user_access('post comments')) {
-              $links['comment-add'] = array(
-                'title' => t('Add new comment'),
-                'href' => "comment/reply/$node->nid",
-                'attributes' => array('title' => t('Add a new comment to this page.')),
-                'fragment' => 'comment-form',
-                'html' => TRUE,
-              );
-            }
-            else {
-              $links['comment_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node));
-            }
-          }
+          $links['comment_forbidden'] = array(
+            'title' => theme('comment_post_forbidden', array('node' => $node)),
+            'html' => TRUE,
+          );
         }
       }
     }
@@ -656,30 +654,32 @@ function comment_node_view($node, $view_
       // But we don't want this link if we're building the node for search
       // indexing.
       if ($node->comment == COMMENT_NODE_OPEN) {
+        $comment_form_location = variable_get('comment_form_location_' . $node->type, COMMENT_FORM_BELOW);
         if (user_access('post comments')) {
-          $links['comment-add'] = array(
-            'title' => t('Add new comment'),
-            'attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')),
-            'fragment' => 'comment-form',
-            'html' => TRUE,
-          );
-          if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_BELOW) == COMMENT_FORM_SEPARATE_PAGE) {
-            $links['comment-add']['href'] = "comment/reply/$node->nid";
-          }
-          else {
-            $links['comment-add']['href'] = "node/$node->nid";
+          // Show the "post comment" link if the form is on another page, or
+          // if there are existing comments that the link will skip past.
+          if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE || !empty($node->comment_count)) {
+            $links['comment-add'] = array(
+              'title' => t('Add new comment'),
+              'attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')),
+              'href' => "node/$node->nid",
+              'fragment' => 'comment-form',
+              'html' => TRUE,
+            );
+            if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE) {
+              $links['comment-add']['href'] = "comment/reply/$node->nid";
+            }
           }
         }
         else {
-          $links['comment_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node));
+          $links['comment_forbidden'] = array(
+            'title' => theme('comment_post_forbidden', array('node' => $node)),
+            'html' => TRUE,
+          );
         }
       }
     }
 
-    if (isset($links['comment_forbidden'])) {
-      $links['comment_forbidden']['html'] = TRUE;
-    }
-
     $node->content['links']['comment'] = array(
       '#theme' => 'links__node__comment',
       '#links' => $links,
@@ -690,7 +690,7 @@ function comment_node_view($node, $view_
     // page. We compare $node and $page_node to ensure that comments are not
     // appended to other nodes shown on the page, for example a node_reference
     // displayed in 'full' view mode within another node.
-    if ($node->comment && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview) && user_access('access comments')) {
+    if ($node->comment && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) {
       $node->content['comments'] = comment_node_page_additions($node);
     }
   }
@@ -708,7 +708,7 @@ function comment_node_page_additions($no
   // Only attempt to render comments if the node has visible comments.
   // Unpublished comments are not included in $node->comment_count, so show
   // comments unconditionally if the user is an administrator.
-  if ($node->comment_count || user_access('administer comments')) {
+  if (($node->comment_count && user_access('access comments')) || user_access('administer comments')) {
     $mode = variable_get('comment_default_mode_' . $node->type, COMMENT_MODE_THREADED);
     $comments_per_page = variable_get('comment_default_per_page_' . $node->type, 50);
     if ($cids = comment_get_thread($node, $mode, $comments_per_page)) {
Index: modules/comment/comment.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.pages.inc,v
retrieving revision 1.40
diff -u -p -r1.40 comment.pages.inc
--- modules/comment/comment.pages.inc	9 Sep 2010 23:01:48 -0000	1.40
+++ modules/comment/comment.pages.inc	28 Nov 2010 02:58:37 -0000
@@ -33,26 +33,26 @@ function comment_reply($node, $pid = NUL
   $op = isset($_POST['op']) ? $_POST['op'] : '';
   $build = array();
 
-  if (user_access('access comments')) {
-    // The user is previewing a comment prior to submitting it.
-    if ($op == t('Preview')) {
-      if (user_access('post comments')) {
-        $build['comment_form'] = drupal_get_form("comment_node_{$node->type}_form", (object) array('pid' => $pid, 'nid' => $node->nid));
-      }
-      else {
-        drupal_set_message(t('You are not authorized to post comments.'), 'error');
-        drupal_goto("node/$node->nid");
-      }
+  // The user is previewing a comment prior to submitting it.
+  if ($op == t('Preview')) {
+    if (user_access('post comments')) {
+      $build['comment_form'] = drupal_get_form("comment_node_{$node->type}_form", (object) array('pid' => $pid, 'nid' => $node->nid));
     }
     else {
-      // $pid indicates that this is a reply to a comment.
-      if ($pid) {
+      drupal_set_message(t('You are not authorized to post comments.'), 'error');
+      drupal_goto("node/$node->nid");
+    }
+  }
+  else {
+    // $pid indicates that this is a reply to a comment.
+    if ($pid) {
+      if (user_access('access comments')) {
         // Load the comment whose cid = $pid
         $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.signature_format, u.picture, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
           ':cid' => $pid,
           ':status' => COMMENT_PUBLISHED,
         ))->fetchObject();
-        if ( $comment ) {
+        if ($comment) {
           // 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) {
@@ -71,29 +71,29 @@ function comment_reply($node, $pid = NUL
           drupal_goto("node/$node->nid");
         }
       }
-      // This is the case where the comment is in response to a node. Display the node.
-      elseif (user_access('access content')) {
-        $build['comment_node'] = node_view($node);
-      }
-
-      // Should we show the reply box?
-      if ($node->comment != COMMENT_NODE_OPEN) {
-        drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error');
-        drupal_goto("node/$node->nid");
-      }
-      elseif (user_access('post comments')) {
-        $edit = array('nid' => $node->nid, 'pid' => $pid);
-        $build['comment_form'] = drupal_get_form("comment_node_{$node->type}_form", (object) $edit);
-      }
       else {
-        drupal_set_message(t('You are not authorized to post comments.'), 'error');
+        drupal_set_message(t('You are not authorized to view comments.'), 'error');
         drupal_goto("node/$node->nid");
       }
     }
-  }
-  else {
-    drupal_set_message(t('You are not authorized to view comments.'), 'error');
-    drupal_goto("node/$node->nid");
+    // This is the case where the comment is in response to a node. Display the node.
+    elseif (user_access('access content')) {
+      $build['comment_node'] = node_view($node);
+    }
+
+    // Should we show the reply box?
+    if ($node->comment != COMMENT_NODE_OPEN) {
+      drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error');
+      drupal_goto("node/$node->nid");
+    }
+    elseif (user_access('post comments')) {
+      $edit = array('nid' => $node->nid, 'pid' => $pid);
+      $build['comment_form'] = drupal_get_form("comment_node_{$node->type}_form", (object) $edit);
+    }
+    else {
+      drupal_set_message(t('You are not authorized to post comments.'), 'error');
+      drupal_goto("node/$node->nid");
+    }
   }
 
   return $build;
Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.92
diff -u -p -r1.92 comment.test
--- modules/comment/comment.test	8 Nov 2010 21:36:45 -0000	1.92
+++ modules/comment/comment.test	28 Nov 2010 04:16:39 -0000
@@ -261,7 +261,7 @@ class CommentInterfaceTest extends Comme
   /**
    * Test comment interface.
    */
-  function testCommentInterface() {
+  function xtestCommentInterface() {
     $langcode = LANGUAGE_NONE;
     // Set comments to have subject and preview disabled.
     $this->drupalLogin($this->admin_user);
@@ -394,7 +394,7 @@ class CommentInterfaceTest extends Comme
   /**
    * Tests the node comment statistics.
    */
-  function testCommentNodeCommentStatistics() {
+  function xtestCommentNodeCommentStatistics() {
     $langcode = LANGUAGE_NONE;
     // Set comments to have subject and preview disabled.
     $this->drupalLogin($this->admin_user);
@@ -473,6 +473,283 @@ class CommentInterfaceTest extends Comme
     $this->assertEqual($node->last_comment_uid, 0, t('The value of node last_comment_uid is zero.'));
     $this->assertEqual($node->comment_count, 2, t('The value of node comment_count is 2.'));
   }
+
+  /**
+   * Tests comment links.
+   *
+   * This test verifies whether the expected comment links are output.
+   *
+   * The output of those links depends on two fundamentally different categories
+   * of environment conditions:
+   * - Internal conditions: Various Comment module configuration settings and
+   *   user access permissions.
+   * - External conditions: Whether the user is authenticated or not, and
+   *   whether any comments exist.
+   *
+   * To account for all possible cases, this test implements two matrices, one
+   * for configuration conditions, and another one for environmental conditions.
+   * Since the expected behavior of comment links is different for each
+   * environment, each set of configuration settings needs to be checked against
+   * each set of environmental conditions.
+   *
+   * The matrices leverage the fact that most environment/configuration settings
+   * can be expressed in 0 or 1.
+   */
+  function testCommentLinks() {
+    // Bartik theme alters comment links, so use a different.
+    theme_enable(array('garland'));
+    variable_set('theme_default', 'garland');
+
+    // Remove additional user permissions from $this->web_user added by setUp(),
+    // since this test is limited to anonymous and authenticated roles only.
+    // @todo Standard installation profile grants authenticated users
+    //   permissions to view and post comments by default, which should have an
+    //   impact on "log in or register to post" links for anonymous users.
+    user_role_delete(key($this->web_user->roles));
+
+    // Matrix of possible configuration settings.
+    $configuration = array(
+      'access comments' => array(0, 1, 0, 0, 1, 0, 1),
+      'post comments'   => array(0, 0, 1, 0, 1, 1, 1),
+      'form'            => array(0, 0, 0, 1, 0, 1, 1),
+      // @todo 0, 1, 2 -- ugh. Later... ;)
+     #'comments'        => array(),
+    );
+
+    // Matrix of possible environment conditions.
+    $conditions = array(
+      'authenticated' => array(0, 1, 0, 1),
+      'comment count' => array(0, 0, 1, 1),
+    );
+
+    // Iterate through conditions matrix.
+    while (current($conditions['authenticated']) !== FALSE) {
+      // For each new environment condition column, start from scratch.
+      $condition_info = array();
+
+      // Use the next column of environment conditions.
+      foreach ($conditions as $condition => $condition_values) {
+        $condition_info[$condition] = current($conditions[$condition]);
+        next($conditions[$condition]);
+      }
+
+      // Iterate through configuration matrix.
+      while (current($configuration['access comments']) !== FALSE) {
+        // Use current environment conditions as base for each column of the
+        // configuration settings.
+        $info = $condition_info;
+
+        // Use the next column of configuration settings.
+        foreach ($configuration as $setting => $setting_values) {
+          $info[$setting] = current($configuration[$setting]);
+          next($configuration[$setting]);
+        }
+
+        // Lastly, perform the comment link assertions.
+        $this->assertCommentLinks($info);
+      }
+
+      // Reset configuration matrix array pointers, so we can iterate over it
+      // again for the next column of environment conditions.
+      foreach ($configuration as $setting => $setting_values) {
+        reset($configuration[$setting]);
+      }
+    }
+  }
+
+  /**
+   * Re-configures comment settings and user permissions.
+   *
+   * @param $info
+   *   An associative array describing the environment to setup.
+   *   Environment conditions:
+   *   - authenticated: 0 or 1. A change to a previously passed value triggers
+   *     a login or logout of $this->web_user accordingly.
+   *   - comment count: 0 or 1. A change to a previously passed value triggers
+   *     the creation or deletion of a comment on $this->node accordingly.
+   *   Configuration settings:
+   *   - form: COMMENT_FORM_BELOW or COMMENT_FORM_SEPARATE_PAGE.
+   *   - contact: COMMENT_ANONYMOUS_MAY_CONTACT,
+   *     COMMENT_ANONYMOUS_MAYNOT_CONTACT, or COMMENT_ANONYMOUS_MUST_CONTACT.
+   *   - comments: COMMENT_NODE_OPEN, COMMENT_NODE_CLOSED, or
+   *     COMMENT_NODE_HIDDEN.
+   *   User permissions:
+   *   - access comments: 0 or 1. Grants or revokes access for the currently
+   *     logged in user.
+   *   - post comments: 0 or 1. Grants or revokes access for the currently
+   *     logged in user.
+   *   - skip comment approval: 0 or 1. Grants or revokes access for the
+   *     currently logged in user.
+   *   - edit own comments: 0 or 1. Grants or revokes access for the currently
+   *     logged in user.
+   */
+  function setEnvironment(array $info) {
+    static $current;
+
+    // Apply defaults to initial environment.
+    if (!isset($current)) {
+      $current = array(
+        'authenticated' => 0,
+        'comment count' => 0,
+        'access comments' => 0,
+        'post comments' => 0,
+        'form' => COMMENT_FORM_BELOW,
+        'contact' => COMMENT_ANONYMOUS_MAY_CONTACT,
+        'comments' => COMMENT_NODE_OPEN,
+        // Enabled by default, because it's irrelevant for this test.
+        'skip comment approval' => 1,
+        'edit own comments' => 0,
+      );
+    }
+    // Complete new environment with current environment.
+    $info = array_merge($current, $info);
+
+    // Change environment conditions.
+    if ($current['authenticated'] != $info['authenticated']) {
+      if ($this->loggedInUser) {
+        $this->drupalLogout();
+      }
+      else {
+        $this->drupalLogin($this->web_user);
+      }
+    }
+    if ($current['comment count'] != $info['comment count']) {
+      if ($info['comment count']) {
+        $raw_comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
+        // @todo ->id... WTF?!
+        $this->comment = comment_load($raw_comment->id);
+      }
+      else {
+        $cids = db_query("SELECT cid FROM {comment}")->fetchCol();
+        comment_delete_multiple($cids);
+        unset($this->comment);
+      }
+    }
+
+    // Change comment settings.
+    variable_set('comment_form_location_' . $this->node->type, $info['form']);
+    variable_set('comment_anonymous_' . $this->node->type, $info['contact']);
+    if ($this->node->comment != $info['comments']) {
+      $this->node->comment = $info['comments'];
+      node_save($this->node);
+    }
+
+    // Change user permissions.
+    $rid = ($this->loggedInUser ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID);
+    $perms = array_intersect_key($info, array('access comments' => 1, 'post comments' => 1, 'skip comment approval' => 1, 'edit own comments' => 1));
+    user_role_change_permissions($rid, $perms);
+
+    // Output verbose debugging information.
+    // @see DrupalTestCase::error()
+    $t_form = array(
+      COMMENT_FORM_BELOW => 'below',
+      COMMENT_FORM_SEPARATE_PAGE => 'separate page',
+    );
+    $t_contact = array(
+      COMMENT_ANONYMOUS_MAY_CONTACT => 'optional',
+      COMMENT_ANONYMOUS_MAYNOT_CONTACT => 'disabled',
+      COMMENT_ANONYMOUS_MUST_CONTACT => 'required',
+    );
+    $t_comments = array(
+      COMMENT_NODE_OPEN => 'open',
+      COMMENT_NODE_CLOSED => 'closed',
+      COMMENT_NODE_HIDDEN => 'hidden',
+    );
+    $verbose = $info;
+    $verbose['form'] = $t_form[$info['form']];
+    $verbose['contact'] = $t_contact[$info['contact']];
+    $verbose['comments'] = $t_comments[$info['comments']];
+    $message = t('Changed environment:<pre>@verbose</pre>', array(
+      '@verbose' => var_export($verbose, TRUE),
+    ));
+    $this->assert('debug', $message, 'Debug');
+
+    // Update current environment.
+    $current = $info;
+
+    return $info;
+  }
+
+  /**
+   * Asserts that comment links appear according to the passed environment setup.
+   *
+   * @param $info
+   *   An associative array describing the environment to pass to
+   *   setEnvironment().
+   */
+  function assertCommentLinks(array $info) {
+    $info = $this->setEnvironment($info);
+
+    $nid = $this->node->nid;
+
+    foreach (array('', "node/$nid") as $path) {
+      $this->drupalGet($path);
+
+      // User is allowed to view comments.
+      if ($info['access comments']) {
+        if ($path == '') {
+          // In teaser view, a link containing the comment count is always
+          // expected.
+          if ($info['comment count']) {
+            $this->assertLink(t('1 comment'));
+
+            // For logged in users, a link containing the amount of new/unread
+            // comments is expected.
+            // See important note about comment_num_new() below.
+            if ($this->loggedInUser && isset($this->comment) && !isset($this->comment->seen)) {
+              $this->assertLink(t('1 new comment'));
+              $this->comment->seen = TRUE;
+            }
+          }
+        }
+      }
+      else {
+        $this->assertNoLink(t('1 comment'));
+        $this->assertNoLink(t('1 new comment'));
+      }
+      // comment_num_new() is based on node views, so comments are marked as
+      // read when a node is viewed, regardless of whether we have access to
+      // comments.
+      if ($path == "node/$nid" && $this->loggedInUser && isset($this->comment)) {
+        $this->comment->seen = TRUE;
+      }
+
+      // User is not allowed to post comments.
+      if (!$info['post comments']) {
+        $this->assertNoLink('Add new comment');
+
+        // Anonymous users should see a note to log in or register in case
+        // authenticated users are allowed to post comments.
+        if (!$this->loggedInUser) {
+          if (user_access('post comments', $this->web_user)) {
+            $this->assertText('Log in or register to post comments');
+          }
+          else {
+            $this->assertNoText('Log in or register to post comments');
+          }
+        }
+      }
+      // User is allowed to post comments.
+      else {
+        $this->assertNoText('Log in or register to post comments');
+
+        // "Add new comment" is always expected, except on a node's page if
+        // there are no comments.
+        if ($path == "node/$nid" && $info['form'] == COMMENT_FORM_BELOW && !$info['comment count']) {
+          $this->assertNoLink('Add new comment');
+        }
+        else {
+          $this->assertLink('Add new comment');
+        }
+
+        // Also verify that the comment form actually appears.
+        if ($path == "node/$nid" && $info['form'] == COMMENT_FORM_BELOW) {
+          $elements = $this->xpath('//form[@id=:id]', array(':id' => 'comment-form'));
+          $this->assertTrue(count($elements), t('Comment form found.'));
+        }
+      }
+    }
+  }
 }
 
 /**
@@ -605,11 +882,12 @@ class CommentAnonymous extends CommentHe
     $this->assertTrue($this->commentExists($anonymous_comment2), t('Anonymous comment with contact info (optional) found.'));
 
     // Ensure anonymous users cannot post in the name of registered users.
+    $langcode = LANGUAGE_NONE;
     $edit = array(
       'name' => $this->admin_user->name,
       'mail' => $this->randomName() . '@example.com',
       'subject' => $this->randomName(),
-      'comment_body[' . LANGUAGE_NONE . '][0][value]' => $this->randomName(),
+      "comment_body[$langcode][0][value]" => $this->randomName(),
     );
     $this->drupalPost('comment/reply/' . $this->node->nid, $edit, t('Save'));
     $this->assertText(t('The name you used belongs to a registered user.'));
@@ -669,14 +947,14 @@ class CommentAnonymous extends CommentHe
     // 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"([^>]*?)>/', t('Comments were not displayed.'));
+    $this->assertNoPattern('@<h2[^>]*>Comments</h2>@', 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', t('Error attempting to post comment.'));
+    $this->assertText('You are not authorized to post comments', t('Error attempting to post comment.'));
     $this->assertNoFieldByName('subject', '', t('Subject field not found.'));
-    $this->assertNoFieldByName('comment[value]', '', t('Comment field not found.'));
+    $this->assertNoFieldByName("comment_body[$langcode][0][value]", '', t('Comment field not found.'));
 
     user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
       'access comments' => TRUE,
@@ -684,9 +962,23 @@ class CommentAnonymous extends CommentHe
       'skip comment approval' => FALSE,
     ));
     $this->drupalGet('node/' . $this->node->nid);
-    $this->assertPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', t('Comments were displayed.'));
+    $this->assertPattern('@<h2[^>]*>Comments</h2>@', 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.'));
+
+    user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
+      'access comments' => FALSE,
+      'post comments' => TRUE,
+      'skip comment approval' => TRUE,
+    ));
+    $this->drupalGet('node/' . $this->node->nid);
+    $this->assertNoPattern('@<h2[^>]*>Comments</h2>@', t('Comments were not displayed.'));
+    $this->assertFieldByName('subject', '', t('Subject field found.'));
+    $this->assertFieldByName("comment_body[$langcode][0][value]", '', t('Comment field found.'));
+
+    $this->drupalGet('comment/reply/' . $this->node->nid . '/' . $anonymous_comment3->id);
+    $this->assertText('You are not authorized to view comments', t('Error attempting to post reply.'));
+    $this->assertNoText($author_name, t('Comment not displayed.'));
   }
 }
 
