summaryrefslogtreecommitdiff
path: root/modules/contact
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-09 02:54:10 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-09 02:54:10 +0000
commit2a7c403158164c35bd03da76effab337092c6481 (patch)
tree9cee7fd5761348f903289513046a35169ccf7993 /modules/contact
parente2e70b1e671d8df6534d379acaeddb2d32a79f6c (diff)
downloadbrdo-2a7c403158164c35bd03da76effab337092c6481.tar.gz
brdo-2a7c403158164c35bd03da76effab337092c6481.tar.bz2
- Patch #597540 by Dave Reid: create a default contact category on install.
Diffstat (limited to 'modules/contact')
-rw-r--r--modules/contact/contact.install15
-rw-r--r--modules/contact/contact.test6
2 files changed, 18 insertions, 3 deletions
diff --git a/modules/contact/contact.install b/modules/contact/contact.install
index 20a65e1b3..384682802 100644
--- a/modules/contact/contact.install
+++ b/modules/contact/contact.install
@@ -66,6 +66,21 @@ function contact_schema() {
}
/**
+ * Implement hook_install().
+ */
+function contact_install() {
+ // Insert a default contact category.
+ db_insert('contact')
+ ->fields(array(
+ 'category' => 'Website feedback',
+ 'recipients' => variable_get('site_mail', ini_get('sendmail_from')),
+ 'selected' => 1,
+ 'reply' => '',
+ ))
+ ->execute();
+}
+
+/**
* Implement hook_uninstall().
*/
function contact_uninstall() {
diff --git a/modules/contact/contact.test b/modules/contact/contact.test
index 89475c6fd..8e03f9f91 100644
--- a/modules/contact/contact.test
+++ b/modules/contact/contact.test
@@ -169,7 +169,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
// Test the auto-reply for category 'foo'.
$email = $this->randomName(32) . '@example.com';
$subject = $this->randomString(64);
- $this->submitContact($this->randomName(16), $email, $subject, 1, $this->randomString(128));
+ $this->submitContact($this->randomName(16), $email, $subject, 2, $this->randomString(128));
// 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'));
@@ -178,7 +178,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
// Test the auto-reply for category 'bar'.
$email = $this->randomName(32) . '@example.com';
- $this->submitContact($this->randomName(16), $email, $this->randomString(64), 2, $this->randomString(128));
+ $this->submitContact($this->randomName(16), $email, $this->randomString(64), 3, $this->randomString(128));
// 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'));
@@ -187,7 +187,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
// 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), 3, $this->randomString(128));
+ $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, t('No auto-reply e-mail was sent to the sender for category "no-autoreply".'), t('Contact'));
}