? .cvsignore
? comment_notify.lib.inc
? unfinished_hash_update.patch
Index: comment_notify.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/comment_notify/comment_notify.test,v
retrieving revision 1.8
diff -u -p -r1.8 comment_notify.test
--- comment_notify.test	11 Oct 2010 01:27:59 -0000	1.8
+++ comment_notify.test	19 Nov 2010 17:31:30 -0000
@@ -56,7 +56,7 @@ class CommentNotifyTestCase extends Drup
     $this->assertText(t($expected_error));
 
     // Try again with an e-mail address.
-    $contact_1 = array('name' => $this->randomName(), 'mail' => $this->randomName() .'@'. $this->randomName());
+    $contact_1 = array('name' => $this->randomName(), 'mail' => $this->getRandomEmailAddress());
     $anonymous_comment_1 = $this->postCommentNotifyComment($this->node, $this->randomName(), $this->randomName(), $subscribe_1, $contact_1);
 
     // Confirm that the notification is saved.
@@ -65,7 +65,7 @@ class CommentNotifyTestCase extends Drup
 
     // Notify type 2 - replies to a comment.
     $subscribe_2 = array('notify' => TRUE, 'notify_type' => 2);
-    $contact_2 = array('name' => $this->randomName(), 'mail' => $this->randomName() .'@'. $this->randomName());
+    $contact_2 = array('name' => $this->randomName(), 'mail' => $this->getRandomEmailAddress());
     $anonymous_comment_2 = $this->postCommentNotifyComment($this->node, $this->randomName(), $this->randomName(), $subscribe_2, $contact_2);
 
     // Confirm that the notification is saved.
@@ -78,7 +78,7 @@ class CommentNotifyTestCase extends Drup
     // Notify type 0 (i.e. only one mode is enabled).
     variable_set('comment_notify_available_alerts', array(1 => 0, 2 => 2));
     $subscribe_0 = array('notify' => TRUE);
-    $contact_0 = array('mail' => $this->randomName() . '@' . $this->randomName());
+    $contact_0 = array('mail' => $this->getRandomEmailAddress());
     $anonymous_comment_0 = $this->postCommentNotifyComment($this->node, $this->randomName(), $this->randomName(), $subscribe_0, $contact_0);
 
     // Confirm that the notification is saved.
@@ -159,4 +159,15 @@ class CommentNotifyTestCase extends Drup
     }
   }
 
+  /**
+   * Returns a randomly generated valid email address
+   * @return string.
+   */
+  function getRandomEmailAddress() {
+    // This doesn't really matter for the purposes of this test, but I guess since
+    // we're making random data, we might was well be fully random.
+    $tlds = array('org', 'com', 'co.uk', 'it', 'name');
+    $tld = $tlds[array_rand($tlds)];
+    return sprintf("%s@%s.%s", $this->randomName(), $this->randomName(), $tld);
+  }
 }
