From c19a471bd5188f7289b6d3aba7d8244a8d96d6b6 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Sat, 2 Dec 2006 19:44:31 +0000 Subject: [PATCH] Unit tests should disable sending email before they execute, we don't want any accidental emails sent when developers are running the unit tests to verify functionality. Add commented out example code that will enable developers to disable email via a define in include/config.php --- include/config.php.sample | 3 +++ include/mail.php | 5 +++++ unit_test/run_tests.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/include/config.php.sample b/include/config.php.sample index bf5bcc8..81beba9 100644 --- a/include/config.php.sample +++ b/include/config.php.sample @@ -19,6 +19,9 @@ define("APPDB_OWNER_URL","http://www.winehq.org/"); // website of this product/c define("APPDB_OWNER_EMAIL","appdb@winehq.org"); // e-mail of this product/company define("BUGZILLA_ROOT","http://bugs.winehq.org/"); // path to bugzilla +// AppDB developers: Use this define to disable email from being sent from the appdb during testing +//if(!defined("DISABLE_EMAIL")) +// define("DISABLE_EMAIL", true); // disable email, see mail_appdb() in include/mail.php /* * apps database info diff --git a/include/mail.php b/include/mail.php index 266b4fb..d580bfe 100644 --- a/include/mail.php +++ b/include/mail.php @@ -3,6 +3,11 @@ require_once(BASE."include/config.php"); function mail_appdb($sEmailList,$sSubject,$sMsg) { + // NOTE: For AppDB developers: If email is disabled return from this function + // immediately. See include/config.php.sample for information + if(defined("DISABLE_EMAIL")) + return; + $sHeaders = "MIME-Version: 1.0\r\n"; $sHeaders .= "From: AppDB <".APPDB_OWNER_EMAIL.">\r\n"; $sHeaders .= "Reply-to: AppDB <".APPDB_OWNER_EMAIL.">\r\n"; diff --git a/unit_test/run_tests.php b/unit_test/run_tests.php index 6b757eb..4d9a8e9 100644 --- a/unit_test/run_tests.php +++ b/unit_test/run_tests.php @@ -7,6 +7,10 @@ error_reporting(E_ALL); +// disable emailing +if(!defined("DISABLE_EMAIL")) + define("DISABLE_EMAIL", true); + include_once("test_user.php"); echo "\n"; include_once("test_query.php");