function UserValidationTestCase::testMailAddresses in Drupal 7
File
- modules/
user/ user.test, line 298 - Tests for user.module.
Class
Code
function testMailAddresses() {
$test_cases = array(
// '<username>' => array('<description>', 'assert<testName>'),
'' => array(
'Empty mail address',
'assertNotNull',
),
'foo' => array(
'Invalid mail address',
'assertNotNull',
),
'foo@example.com' => array(
'Valid mail address',
'assertNull',
),
);
foreach ($test_cases as $name => $test_case) {
list($description, $test) = $test_case;
$result = user_validate_mail($name);
$this
->{$test}($result, $description . ' (' . $name . ')');
}
}