aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functions/validate_email_test.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2014-06-09 17:55:25 +0200
committerNils Adermann <naderman@naderman.de>2014-06-09 17:55:25 +0200
commitb6232aa9b213fbf62f5ce351bc79220daf243cc6 (patch)
tree0e169650c4b0bb9476b5f0f917bff6952b574e4d /tests/functions/validate_email_test.php
parent0c5af536f1de55b6ee30ab9f193b6ea7637ac5b1 (diff)
parent92f43c5371f1f37bd6d77ade2fc5e2804b5cc49f (diff)
downloadforums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.tar
forums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.tar.gz
forums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.tar.bz2
forums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.tar.xz
forums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.zip
Merge remote-tracking branch 'github-nickvergessen/ticket/10073' into develop-ascraeus
* github-nickvergessen/ticket/10073: (36 commits) [ticket/10073] Fix button descriptions [ticket/10073] Do not check disable boxes by default [ticket/10073] Store values with config_text in the ACP [ticket/10073] Move config values to config_text [ticket/10073] Fix request usage [ticket/10073] Deduplicate template variable names [ticket/10073] Get service from container [ticket/10073] Fix more "Contact Us" strings [ticket/10073] Move template code into the template [ticket/10073] Make contact page available when board is disabled [ticket/10073] Change name of the ACP module [ticket/10073] Deduplicate posting buttons code in ACP [ticket/10073] Use phpbb_validate_email to verify email address [ticket/10073] Add tests for new validate_email() [ticket/10073] Split email validation from email ban and taken checks [ticket/10073] Deduplicate the if statement [ticket/10073] Fallback to board_contact when contact page is disabled [ticket/10073] Remove language string from rebase conflict [ticket/10073] Add ACP module to add bbcode text for contact admin info [ticket/10073] Add new configs to the schema ...
Diffstat (limited to 'tests/functions/validate_email_test.php')
-rw-r--r--tests/functions/validate_email_test.php80
1 files changed, 35 insertions, 45 deletions
diff --git a/tests/functions/validate_email_test.php b/tests/functions/validate_email_test.php
index dbd4b05520..b46509fda7 100644
--- a/tests/functions/validate_email_test.php
+++ b/tests/functions/validate_email_test.php
@@ -1,13 +1,9 @@
<?php
/**
*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
+* @package testing
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -51,60 +47,54 @@ class phpbb_functions_validate_email_test extends phpbb_database_test_case
$user->optionset('banned_users', array('banned@example.com'));
}
- public function test_validate_email()
+ public static function validate_email_data()
+ {
+ return array(
+ array('empty', array('EMAIL_INVALID'), ''), // email does not allow empty
+ array('allowed', array(), 'foobar@example.com'),
+ array('valid_complex', array(), "'%$~test@example.com"),
+ array('invalid', array('EMAIL_INVALID'), 'fööbar@example.com'),
+ array('taken', array(), 'admin@example.com'), // email does not check taken, should use user_email instead
+ array('banned', array(), 'banned@example.com'), // email does not check ban, should use user_email instead
+ );
+ }
+
+ /**
+ * @dataProvider validate_email_data
+ */
+ public function test_validate_email($case, $errors, $email)
{
$this->set_validation_prerequisites(false);
$this->helper->assert_valid_data(array(
- 'empty' => array(
- array(),
- '',
- array('email'),
- ),
- 'allowed' => array(
- array(),
- 'foobar@example.com',
- array('email', 'foobar@example.com'),
- ),
- 'invalid' => array(
- array('EMAIL_INVALID'),
- 'fööbar@example.com',
- array('email'),
- ),
- 'valid_complex' => array(
- array(),
- "'%$~test@example.com",
- array('email'),
- ),
- 'taken' => array(
- array('EMAIL_TAKEN'),
- 'admin@example.com',
- array('email'),
- ),
- 'banned' => array(
- array('EMAIL_BANNED'),
- 'banned@example.com',
+ $case => array(
+ $errors,
+ $email,
array('email'),
),
));
}
+ public static function validate_email_mx_data()
+ {
+ return array(
+ array('valid', array(), 'foobar@phpbb.com'),
+ array('no_mx', array('DOMAIN_NO_MX_RECORD'), 'test@does-not-exist.phpbb.com'),
+ );
+ }
+
/**
+ * @dataProvider validate_email_mx_data
* @group slow
*/
- public function test_validate_email_mx()
+ public function test_validate_email_mx($case, $errors, $email)
{
$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@does-not-exist.phpbb.com',
+ $case => array(
+ $errors,
+ $email,
array('email'),
),
));