Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.10
diff -u -r1.10 comment.test
--- modules/comment/comment.test	3 Jul 2008 17:57:03 -0000	1.10
+++ modules/comment/comment.test	29 Aug 2008 13:57:07 -0000
@@ -1,6 +1,64 @@
 <?php
 // $Id: comment.test,v 1.10 2008/07/03 17:57:03 dries Exp $
 
+class CommentSignatureTestCase extends DrupalWebTestCase {
+  protected $admin_user;
+  protected $web_user;
+  protected $node;
+
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Comment Signatures'),
+      'description' => t('Test that user signatures are displayed in comments.'),
+      'group' => t('Comment'),
+    );
+  }
+
+  /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    parent::setUp();
+    
+    variable_set('user_signatures', 1);
+    // Create users.
+    $this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content'));
+  }
+
+  /*
+   * Test signatures.
+   */
+  function testCommentSignatures() {
+    $this->drupalLogin($this->web_user);
+    
+    // Set signature for the user.
+    $this->drupalGet('user/' . $this->web_user->uid . '/edit');
+    $edit = array();
+    $signature = $this->randomName();
+    $edit['signature'] = $signature;
+    $this->drupalPost(NULL, $edit, 'Save');
+    
+    // Create node and comment on it.
+    $node = $this->drupalCreateNode(array('type'=> 'article'));
+    $this->drupalGet('comment/reply/' . $node->nid);
+    $comment = $this->drupalPostComment(NULL, $this->randomName(), $this->randomName());
+    $this->assertText($signature, t('Signature found on comment'));
+    
+    // Change the signature and ensure it replaces the old one.
+    $this->drupalGet('user/' . $this->web_user->uid . '/edit');
+    $edit = array();
+    $signature = $this->randomName();
+    $edit['signature'] = $signature;
+    $this->drupalPost(NULL, $edit, 'Save');
+    $this->drupalGet('node/' . $node->nid);
+    $this->assertText($signature, t('New signature has replaced the old one on existing comment'));
+  }
+}
+
+
 class CommentTestCase extends DrupalWebTestCase {
   protected $admin_user;
   protected $web_user;
@@ -21,7 +79,7 @@
    * Implementation of setUp().
    */
   function setUp() {
-    parent::setUp('comment');
+    parent::setUp();
     // Create users.
     $this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer permissions'));
     $this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content'));
@@ -56,17 +114,17 @@
 
     // Create comment that requires preview.
     $this->drupalLogin($this->web_user);
-    $comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $comment = $this->drupalPostComment($this->node, $this->randomName(), $this->randomName());
     $this->assertTrue($this->commentExists($comment), t('Comment found.'));
 
     // Reply to comment.
     $this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
-    $reply = $this->postComment(NULL, $this->randomName(), $this->randomName());
+    $reply = $this->drupalPostComment(NULL, $this->randomName(), $this->randomName());
     $this->assertTrue($this->commentExists($reply, TRUE), t('Reply found.'));
 
     // Edit reply.
     $this->drupalGet('comment/edit/' . $reply->id);
-    $reply = $this->postComment(NULL, $this->randomName(), $this->randomName());
+    $reply = $this->drupalPostComment(NULL, $this->randomName(), $this->randomName());
     $this->assertTrue($this->commentExists($reply, TRUE), t('Modified reply found.'));
 
     // Correct link count
@@ -75,7 +133,7 @@
 
     // Pager
     $this->setCommentsPerPage(2);
-    $comment_new_page = $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $comment_new_page = $this->drupalPostComment($this->node, $this->randomName(), $this->randomName());
     $this->drupalGet('node/' . $this->node->nid);
     $this->assertTrue($this->commentExists($comment) && $this->commentExists($comment_new_page), t('Page one exists. %s'));
     $this->drupalGet('node/' . $this->node->nid, array('query' => 'page=1'));
@@ -105,7 +163,7 @@
     // Submit comment through node form.
     $this->drupalLogin($this->web_user);
     $this->drupalGet('node/' . $this->node->nid);
-    $form_comment = $this->postComment(NULL, $this->randomName(), $this->randomName());
+    $form_comment = $this->drupalPostComment(NULL, $this->randomName(), $this->randomName());
     $this->assertTrue($this->commentExists($form_comment), t('Form comment found.'));
 
     // Disable comment form on node page.
@@ -125,7 +183,7 @@
     $this->drupalLogout();
 
     // Post anonymous comment without contact info.
-    $anonymous_comment1 = $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $anonymous_comment1 = $this->drupalPostComment($this->node, $this->randomName(), $this->randomName());
     $this->assertTrue($this->commentExists($anonymous_comment1), t('Anonymous comment without contact info found.'));
 
     // Allow contact info.
@@ -137,7 +195,7 @@
     $this->drupalGet('comment/reply/' . $this->node->nid);
     $this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.'));
 
-    $anonymous_comment2 = $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $anonymous_comment2 = $this->drupalPostComment($this->node, $this->randomName(), $this->randomName());
     $this->assertTrue($this->commentExists($anonymous_comment2), t('Anonymous comment with contact info (optional) found.'));
 
     // Require contact info.
@@ -149,12 +207,12 @@
     $this->drupalGet('comment/reply/' . $this->node->nid);
     $this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.'));
 
-    $anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE, TRUE);
+    $anonymous_comment3 = $this->drupalPostComment($this->node, $this->randomName(), $this->randomName(), TRUE, TRUE);
     $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).
-    $anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE, array('mail' => 'tester@simpletest.org'));
+    $anonymous_comment3 = $this->drupalPostComment($this->node, $this->randomName(), $this->randomName(), TRUE, array('mail' => 'tester@simpletest.org'));
     $this->assertTrue($this->commentExists($anonymous_comment3), t('Anonymous comment with contact info (required) found.'));
 
     // Unpublish comment.
@@ -195,7 +253,7 @@
     // Post anonymous comment without contact info.
     $subject = $this->randomName();
     $body = $this->randomName();
-    $this->postComment($this->node, $subject, $body, TRUE, TRUE); // Set $contact to true so that it won't check for id and message.
+    $this->drupalPostComment($this->node, $subject, $body, TRUE, TRUE); // Set $contact to true so that it won't check for id and message.
     $this->assertText(t('Your comment has been queued for moderation by site administrators and will be published after approval.'), t('Comment requires approval.'));
 
     // Get unaproved comment id.
@@ -229,7 +287,7 @@
     // Post anonymous comment without contact info.
     $subject = $this->randomName();
     $body = $this->randomName();
-    $this->postComment($this->node, $subject, $body, TRUE, TRUE); // Set $contact to true so that it won't check for id and message.
+    $this->drupalPostComment($this->node, $subject, $body, TRUE, TRUE); // Set $contact to true so that it won't check for id and message.
     $this->assertText(t('Your comment has been queued for moderation by site administrators and will be published after approval.'), t('Comment requires approval.'));
 
     // Get unaproved comment id.
@@ -251,48 +309,6 @@
   }
 
   /**
-   * Post comment.
-   *
-   * @param object $node Node to post comment on.
-   * @param string $subject Comment subject.
-   * @param string $comment Comment body.
-   * @param boolean $preview Should preview be required.
-   * @param mixed $contact Set to NULL for no contact info, TRUE to ignore success checking, and array of values to set contact info.
-   */
-  function postComment($node, $subject, $comment, $preview = TRUE, $contact = NULL) {
-    $edit = array();
-    $edit['subject'] = $subject;
-    $edit['comment'] = $comment;
-
-    if ($contact !== NULL && is_array($contact)) {
-      $edit += $contact;
-    }
-
-    if ($node !== NULL) {
-      $this->drupalGet('comment/reply/' . $node->nid);
-    }
-
-    if ($preview) {
-      $this->assertNoFieldByName('op', t('Save'), t('Save button not found.')); // Preview required so no save button should be found.
-      $this->drupalPost(NULL, $edit, t('Preview'));
-    }
-    $this->drupalPost(NULL, $edit, t('Save'));
-    $match = array();
-    // Get comment ID
-    preg_match('/#comment-([^"]+)/', $this->getURL(), $match);
-
-    // Get comment.
-    if ($contact !== TRUE) { // If true then attempting to find error message.
-      $this->assertText($subject, 'Comment posted.');
-      $this->assertTrue((!empty($match) && !empty($match[1])), t('Comment id found.'));
-    }
-
-    if (isset($match[1])) {
-      return (object) array('id' => $match[1], 'subject' => $subject, 'comment' => $comment);
-    }
-  }
-
-  /**
    * Checks current page for specified comment.
    *
    * @param object $comment Comment object.
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.34
diff -u -r1.34 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	23 Aug 2008 07:42:54 -0000	1.34
+++ modules/simpletest/drupal_web_test_case.php	29 Aug 2008 13:57:07 -0000
@@ -363,6 +363,49 @@
   }
 
   /**
+   * Posts a comment to a node.
+   *
+   * @param object $node Node to post comment on.
+   * @param string $subject Comment subject.
+   * @param string $comment Comment body.
+   * @param boolean $preview Should preview be required.
+   * @param mixed $contact Set to NULL for no contact info, TRUE to ignore success checking, and array of values to set contact info.
+   */
+  function drupalPostComment($node, $subject, $comment, $preview = TRUE, $contact = NULL) {
+    $edit = array();
+    $edit['subject'] = $subject;
+    $edit['comment'] = $comment;
+
+    if ($contact !== NULL && is_array($contact)) {
+      $edit += $contact;
+    }
+
+    if ($node !== NULL) {
+      $this->drupalGet('comment/reply/' . $node->nid);
+    }
+
+    if ($preview) {
+      $this->assertNoFieldByName('op', t('Save'), t('Save button not found.')); // Preview required so no save button should be found.
+      $this->drupalPost(NULL, $edit, t('Preview'));
+    }
+    $this->drupalPost(NULL, $edit, t('Save'));
+    $match = array();
+
+    // Get comment ID
+    preg_match('/#comment-([^"]+)/', $this->getURL(), $match);
+
+    // Get comment.
+    if ($contact !== TRUE) { // If true then attempting to find error message.
+      $this->assertText($subject, t('Comment posted.'));
+      $this->assertTrue((!empty($match) && !empty($match[1])), t('Comment id found.'));
+    }
+
+    if (isset($match[1])) {
+      return (object) array('id' => $match[1], 'subject' => $subject, 'comment' => $comment);
+    }
+  }
+
+  /**
    * Creates a custom content type based on default settings.
    *
    * @param $settings
