function UserNameValidatorTest::validUsernameProvider

Same name in other branches
  1. 11.x core/modules/user/tests/src/Kernel/UserNameValidatorTest.php \Drupal\Tests\user\Kernel\UserNameValidatorTest::validUsernameProvider()

Provides valid user names.

File

core/modules/user/tests/src/Kernel/UserNameValidatorTest.php, line 60

Class

UserNameValidatorTest
Verify that user validity checks behave as designed.

Namespace

Drupal\Tests\user\Kernel

Code

public static function validUsernameProvider() : array {
    // cSpell:disable
    return [
        'lowercase' => [
            'foo',
        ],
        'uppercase' => [
            'FOO',
        ],
        'contains space' => [
            'Foo O\'Bar',
        ],
        'contains @' => [
            'foo@bar',
        ],
        'allow email' => [
            'foo@example.com',
        ],
        'allow invalid domain' => [
            'foo@-example.com',
        ],
        'allow special chars' => [
            'þòøÇߪř€',
        ],
        'allow plus' => [
            'foo+bar',
        ],
        'utf8 runes' => [
            'ᚠᛇᚻ᛫ᛒᛦᚦ',
        ],
    ];
    // cSpell:enable
}

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