1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-01 05:08:57 +02:00

[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
This commit is contained in:
Marc Alexander 2013-06-05 17:36:20 +02:00
parent 6a77ee1f30
commit c6ba894acd

@ -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'),
),
));