aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functions
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functions')
-rw-r--r--tests/functions/validate_email_test.php32
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/functions/validate_email_test.php b/tests/functions/validate_email_test.php
index 93b5ba0896..9a6ce39251 100644
--- a/tests/functions/validate_email_test.php
+++ b/tests/functions/validate_email_test.php
@@ -32,14 +32,24 @@ class phpbb_functions_validate_email_test extends phpbb_database_test_case
$this->helper = new phpbb_functions_validate_data_helper($this);
}
- public function test_validate_email()
+ /**
+ * Get validation prerequesites
+ *
+ * @param bool $check_mx Whether mx records should be checked
+ */
+ protected function set_validation_prerequisites($check_mx)
{
global $config, $db, $user;
- $config['email_check_mx'] = true;
+ $config['email_check_mx'] = $check_mx;
$db = $this->db;
$user = $this->user;
$user->optionset('banned_users', array('banned@example.com'));
+ }
+
+ public function test_validate_email()
+ {
+ $this->set_validation_prerequisites(false);
$this->helper->assert_valid_data(array(
'empty' => array(
@@ -72,9 +82,25 @@ class phpbb_functions_validate_email_test extends phpbb_database_test_case
'banned@example.com',
array('email'),
),
+ ));
+ }
+
+ /**
+ * @group slow
+ */
+ public function test_validate_email_mx()
+ {
+ $this->set_validation_prerequisites(true);
+
+ $this->helper->assert_valid_data(array(
+ 'valid' => array(
+ array(),
+ 'foobar@phpbb.com',
+ array('email'),
+ ),
'no_mx' => array(
array('DOMAIN_NO_MX_RECORD'),
- 'test@wwrrrhhghgghgh.ttv',
+ 'test@does-not-exist.phpbb.com',
array('email'),
),
));