? signaturetest.patch
? modules/simpletest/.simpletest.module.swp
? sites/default/files
? sites/default/settings.php
Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.10
diff -u -p -r1.10 comment.test
--- modules/comment/comment.test	3 Jul 2008 17:57:03 -0000	1.10
+++ modules/comment/comment.test	28 Aug 2008 08:41:55 -0000
@@ -1,6 +1,88 @@
 <?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('Signatures.'),
+      'group' => t('Comment'),
+    );
+  }
+
+  /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    parent::setUp('comment');
+    variable_set('user_signatures', 1);
+    // 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'));
+
+    $this->drupalLogin($this->web_user);
+    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
+    $this->assertTrue($this->node, t('Article node created.'));
+    $this->drupalLogout();
+  }
+  /*
+   * Test signatures.
+   */
+  function testCommentSignatures() {
+    $this->drupalLogin($this->web_user);
+    $uid = $this->web_user->uid;
+    $this->drupalGet('user/' . $uid . '/edit');
+    $edit = array();
+    $signature = $this->randomName();
+    $edit['signature'] = $signature;
+    $this->drupalPost(NULL, $edit, 'Save');
+    $node = $this->drupalCreateNode();
+    $this->drupalGet('node/' . $node->nid);
+    $comment = $this->postComment(NULL, $this->randomName(), $this->randomName());
+  }
+    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);
+    }
+  }
+
+}
+
+
 class CommentTestCase extends DrupalWebTestCase {
   protected $admin_user;
   protected $web_user;
@@ -22,6 +104,7 @@ class CommentTestCase extends DrupalWebT
    */
   function setUp() {
     parent::setUp('comment');
+    variable_set('user_signatures', 1);
     // 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'));
@@ -32,6 +115,7 @@ class CommentTestCase extends DrupalWebT
     $this->drupalLogout();
   }
 
+
   /**
    * Test comment interface.
    */
