summaryrefslogtreecommitdiff
path: root/modules/contact
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-08-05 23:53:39 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-08-05 23:53:39 +0000
commit25171a17f626695ecf984cc44b60d3eae1310b4c (patch)
tree3268ef89294cbb96d0875d665012c4ff16d8c68a /modules/contact
parentcacd044a6398df92de68c5aea31987ac0fff507a (diff)
downloadbrdo-25171a17f626695ecf984cc44b60d3eae1310b4c.tar.gz
brdo-25171a17f626695ecf984cc44b60d3eae1310b4c.tar.bz2
Reverting #500866. Needs more discussion.
Diffstat (limited to 'modules/contact')
-rw-r--r--modules/contact/contact.test72
1 files changed, 36 insertions, 36 deletions
diff --git a/modules/contact/contact.test b/modules/contact/contact.test
index 04020947d..80a157b87 100644
--- a/modules/contact/contact.test
+++ b/modules/contact/contact.test
@@ -33,7 +33,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
$edit = array();
$edit['contact_default_status'] = TRUE;
$this->drupalPost('admin/config/people/accounts', $edit, t('Save configuration'));
- $this->assertText(t('The configuration options have been saved.'), 'Setting successfully saved.');
+ $this->assertText(t('The configuration options have been saved.'), t('Setting successfully saved.'));
// Delete old categories to ensure that new categories are used.
$this->deleteCategories();
@@ -53,21 +53,21 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
$invalid_recipients = array('invalid', 'invalid@', 'invalid@site.', '@site.', '@site.com');
foreach ($invalid_recipients as $invalid_recipient) {
$this->addCategory($this->randomName(16), $invalid_recipient, '', FALSE);
- $this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)), 'Caught invalid recipient (' . $invalid_recipient . ').');
+ $this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)), t('Caught invalid recipient (' . $invalid_recipient . ').'));
}
// Test validation of empty category and recipients fields.
$this->addCategory($category = '', '', '', TRUE);
- $this->assertText(t('Category field is required.'), 'Caught empty category field');
- $this->assertText(t('Recipients field is required.'), 'Caught empty recipients field.');
+ $this->assertText(t('Category field is required.'), t('Caught empty category field'));
+ $this->assertText(t('Recipients field is required.'), t('Caught empty recipients field.'));
// Create first valid category.
$recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com');
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0])), '', TRUE);
- $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
// Make sure the newly created category is included in the list of categories.
- $this->assertNoUniqueText($category, 'New category included in categories list.');
+ $this->assertNoUniqueText($category, t('New category included in categories list.'));
// Test update contact form category.
$categories = $this->getCategories();
@@ -77,80 +77,80 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
$this->assertEqual($category_array['recipients'], $recipients_str);
$this->assertEqual($category_array['reply'], $reply);
$this->assertFalse($category_array['selected']);
- $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
// Ensure that the contact form is shown without a category selection input.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
$this->drupalLogout();
$this->drupalGet('contact');
- $this->assertText(t('Your e-mail address'), 'Contact form is shown when there is one category.');
- $this->assertNoText(t('Category'), 'When there is only one category, the category selection element is hidden.');
+ $this->assertText(t('Your e-mail address'), t('Contact form is shown when there is one category.'));
+ $this->assertNoText(t('Category'), t('When there is only one category, the category selection element is hidden.'));
$this->drupalLogin($admin_user);
// Add more categories.
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
- $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
- $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
// Try adding a category that already exists.
$this->addCategory($category, '', '', FALSE);
- $this->assertNoRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category not saved.');
- $this->assertRaw(t('A contact form with category %category already exists.', array('%category' => $category)), 'Duplicate category error found.');
+ $this->assertNoRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category not saved.'));
+ $this->assertRaw(t('A contact form with category %category already exists.', array('%category' => $category)), t('Duplicate category error found.'));
// Clear flood table in preparation for flood test and allow other checks to complete.
db_delete('flood')->execute();
$num_records_after = db_query("SELECT COUNT(*) FROM {flood}")->fetchField();
- $this->assertIdentical($num_records_after, '0', 'Flood table emptied.');
+ $this->assertIdentical($num_records_after, '0', t('Flood table emptied.'));
$this->drupalLogout();
// Check to see that anonymous user cannot see contact page without permission.
user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
$this->drupalGet('contact');
- $this->assertResponse(403, 'Access denied to anonymous user without permission.');
+ $this->assertResponse(403, t('Access denied to anonymous user without permission.'));
// Give anonymous user permission and see that page is viewable.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
$this->drupalGet('contact');
- $this->assertResponse(200, 'Access granted to anonymous user with permission.');
+ $this->assertResponse(200, t('Access granted to anonymous user with permission.'));
// Submit contact form with invalid values.
$this->submitContact('', $recipients[0], $this->randomName(16), $categories[0], $this->randomName(64));
- $this->assertText(t('Your name field is required.'), 'Name required.');
+ $this->assertText(t('Your name field is required.'), t('Name required.'));
$this->submitContact($this->randomName(16), '', $this->randomName(16), $categories[0], $this->randomName(64));
- $this->assertText(t('Your e-mail address field is required.'), 'E-mail required.');
+ $this->assertText(t('Your e-mail address field is required.'), t('E-mail required.'));
$this->submitContact($this->randomName(16), $invalid_recipients[0], $this->randomName(16), $categories[0], $this->randomName(64));
- $this->assertText(t('You must enter a valid e-mail address.'), 'Valid e-mail required.');
+ $this->assertText(t('You must enter a valid e-mail address.'), t('Valid e-mail required.'));
$this->submitContact($this->randomName(16), $recipients[0], '', $categories[0], $this->randomName(64));
- $this->assertText(t('Subject field is required.'), 'Subject required.');
+ $this->assertText(t('Subject field is required.'), t('Subject required.'));
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $categories[0], '');
- $this->assertText(t('Message field is required.'), 'Message required.');
+ $this->assertText(t('Message field is required.'), t('Message required.'));
// Test contact form with no default category selected.
db_update('contact')
->fields(array('selected' => 0))
->execute();
$this->drupalGet('contact');
- $this->assertRaw(t('- Please choose -'), 'Without selected categories the visitor is asked to chose a category.');
+ $this->assertRaw(t('- Please choose -'), t('Without selected categories the visitor is asked to chose a category.'));
// Submit contact form with invalid category id (cid 0).
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), 0, '');
- $this->assertText(t('You must select a valid category.'), 'Valid category required.');
+ $this->assertText(t('You must select a valid category.'), t('Valid category required.'));
// Submit contact form with correct values and check flood interval.
for ($i = 0; $i < $flood_limit; $i++) {
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $categories[0], $this->randomName(64));
- $this->assertText(t('Your message has been sent.'), 'Message sent.');
+ $this->assertText(t('Your message has been sent.'), t('Message sent.'));
}
// Submit contact form one over limit.
$this->drupalGet('contact');
- $this->assertResponse(403, 'Access denied to anonymous user after reaching message treshold.');
- $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => variable_get('contact_threshold_limit', 3), '@interval' => format_interval(600))), 'Message threshold reached.');
+ $this->assertResponse(403, t('Access denied to anonymous user after reaching message treshold.'));
+ $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => variable_get('contact_threshold_limit', 3), '@interval' => format_interval(600))), t('Message threshold reached.'));
// Delete created categories.
$this->drupalLogin($admin_user);
@@ -158,8 +158,8 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
}
/**
- * Test auto-reply on the site-wide contact form.
- */
+ * Test auto-reply on the site-wide contact form.
+ */
function testAutoReply() {
// Create and login administrative user.
$admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer permissions', 'administer users'));
@@ -179,8 +179,8 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
// We are testing the auto-reply, so there should be one e-mail going to the sender.
$captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email, 'from' => 'foo@example.com'));
- $this->assertEqual(count($captured_emails), 1, 'Auto-reply e-mail was sent to the sender for category "foo".', 'Contact');
- $this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($foo_autoreply), 'Auto-reply e-mail body is correct for category "foo".', 'Contact');
+ $this->assertEqual(count($captured_emails), 1, t('Auto-reply e-mail was sent to the sender for category "foo".'), t('Contact'));
+ $this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($foo_autoreply), t('Auto-reply e-mail body is correct for category "foo".'), t('Contact'));
// Test the auto-reply for category 'bar'.
$email = $this->randomName(32) . '@example.com';
@@ -188,14 +188,14 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
// Auto-reply for category 'bar' should result in one auto-reply e-mail to the sender.
$captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email, 'from' => 'bar@example.com'));
- $this->assertEqual(count($captured_emails), 1, 'Auto-reply e-mail was sent to the sender for category "bar".', 'Contact');
- $this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($bar_autoreply), 'Auto-reply e-mail body is correct for category "bar".', 'Contact');
+ $this->assertEqual(count($captured_emails), 1, t('Auto-reply e-mail was sent to the sender for category "bar".'), t('Contact'));
+ $this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($bar_autoreply), t('Auto-reply e-mail body is correct for category "bar".'), t('Contact'));
// Verify that no auto-reply is sent when the auto-reply field is left blank.
$email = $this->randomName(32) . '@example.com';
$this->submitContact($this->randomName(16), $email, $this->randomString(64), 4, $this->randomString(128));
$captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email, 'from' => 'no_autoreply@example.com'));
- $this->assertEqual(count($captured_emails), 0, 'No auto-reply e-mail was sent to the sender for category "no-autoreply".', 'Contact');
+ $this->assertEqual(count($captured_emails), 0, t('No auto-reply e-mail was sent to the sender for category "no-autoreply".'), t('Contact'));
}
/**
@@ -261,7 +261,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
foreach ($categories as $category) {
$category_name = db_query("SELECT category FROM {contact} WHERE cid = :cid", array(':cid' => $category))->fetchField();
$this->drupalPost('admin/structure/contact/delete/' . $category, array(), t('Delete'));
- $this->assertRaw(t('Category %category has been deleted.', array('%category' => $category_name)), 'Category deleted sucessfully.');
+ $this->assertRaw(t('Category %category has been deleted.', array('%category' => $category_name)), t('Category deleted sucessfully.'));
}
}
@@ -336,7 +336,7 @@ class ContactPersonalTestCase extends DrupalWebTestCase {
$this->drupalLogin($this->admin_user);
$edit = array('contact_default_status' => FALSE);
$this->drupalPost('admin/config/people/accounts', $edit, t('Save configuration'));
- $this->assertText(t('The configuration options have been saved.'), 'Setting successfully saved.');
+ $this->assertText(t('The configuration options have been saved.'), t('Setting successfully saved.'));
$this->drupalLogout();
// Re-create our contacted user with personal contact forms disabled by
@@ -388,7 +388,7 @@ class ContactPersonalTestCase extends DrupalWebTestCase {
}
// Submit contact form one over limit.
- $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
+ $this->drupalGet('user/' . $this->contact_user->uid. '/contact');
$this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $flood_limit, '@interval' => format_interval(variable_get('contact_threshold_window', 3600)))), 'Normal user denied access to flooded contact form.');
// Test that the admin user can still access the contact form even though