function UserValidationTestCase::testMailAddresses

File

modules/user/user.test, line 299

Class

UserValidationTestCase

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 . ')');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.