aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-06-05 17:36:20 +0200
committerMarc Alexander <admin@m-a-styles.de>2013-06-05 17:40:45 +0200
commitc6ba894acdfdf5b0800dc3903d01605ddd83e8e9 (patch)
treedb84ac4f816433d691f72852cfa9a843e62a516c /tests
parent6a77ee1f30961f6363818691f91162fa67618872 (diff)
downloadforums-c6ba894acdfdf5b0800dc3903d01605ddd83e8e9.tar
forums-c6ba894acdfdf5b0800dc3903d01605ddd83e8e9.tar.gz
forums-c6ba894acdfdf5b0800dc3903d01605ddd83e8e9.tar.bz2
forums-c6ba894acdfdf5b0800dc3903d01605ddd83e8e9.tar.xz
forums-c6ba894acdfdf5b0800dc3903d01605ddd83e8e9.zip
[ticket/11579] Add method for validating emails for valid MX and mark as slow
A method for setting up the prerequisities also has been added in order to reduce the amount of necessary code. PHPBB3-11579
Diffstat (limited to 'tests')
-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'),
),
));