Index: tests/mollom.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/tests/Attic/mollom.test,v
retrieving revision 1.1.2.17
diff -u -p -r1.1.2.17 mollom.test
--- tests/mollom.test	10 Jun 2009 07:05:56 -0000	1.1.2.17
+++ tests/mollom.test	18 Jun 2009 16:12:27 -0000
@@ -617,3 +617,57 @@ class MollomResellerTestCase extends Mol
     }
   }
 }
+
+class MollomRegressionTestCase extends MollomWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => t('Regression tests'),
+      'description' => t('Check that fixed issues do not regress.'),
+      'group' => t('Mollom'),
+    );
+  }
+
+  function setUp() {
+    parent::setUp('mollom', 'comment');
+    $this->mollomKeySetup();
+  }
+
+  /**
+   * Regression test for http://drupal.org/node/491186.
+   */
+  function test491186() {
+    // Allow anonymous users to post comments.
+    db_query("UPDATE {permission} SET perm = CONCAT(perm, ', access comments, post comments') WHERE rid = %d", DRUPAL_ANONYMOUS_RID);
+
+    // Enable Mollom text-classification for comments.
+    $this->mollomSetAdminOptions(array('mollom_comment_form' => MOLLOM_MODE_ANALYSIS));
+
+    // Create a new story and then a user to log in.
+    $node = $this->drupalCreateNode(array('type' => 'story'));
+    $account = $this->drupalCreateUser();
+
+    // Fill out both the login block form and the comment form, but only submit
+    // the login form. Mollom should not block the attempt.
+    $edit = array(
+      'name' => $account->name,
+      'pass' => $account->pass_raw,
+      'comment' => 'unsure',
+      'op' => t('Log in'),
+      'form_id' => 'user_login_block',
+    );
+
+    // We have to 'simulate' a drupalPost() since it won't allow us to submit
+    // fields from multiple forms.
+    foreach ($edit as $key => $value) {
+      $edit[$key] = urlencode($key) . '=' . urlencode($value);
+    }
+    $edit = implode('&', $edit);
+    $this->curlExec(array(CURLOPT_URL => url('comment/reply/' . $node->nid, array('absolute' => TRUE)), CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $edit));
+
+    // Check that the user was logged in correctly.
+    $this->assertLink(t('Log out'), 0, t('User %name successfully logged in.', array('%name' => $account->name)));
+
+    // Test that Mollom did not check the comment form submission.
+    $this->assertNoText(t('Your submission has triggered the spam filter and will not be accepted.'));
+  }
+}
