function UserRequirementsTest::testConflictingUserEmails

Tests that the requirements check can detect conflicting user emails.

See also

\Drupal\Tests\user\Kernel\UserValidationTest::testValidation

File

core/modules/user/tests/src/Kernel/UserRequirementsTest.php, line 38

Class

UserRequirementsTest
Tests user_requirements().

Namespace

Drupal\Tests\user\Kernel

Code

public function testConflictingUserEmails() : void {
    $output = \user_requirements('runtime');
    $this->assertArrayNotHasKey('conflicting emails', $output);
    $this->createUser([], 'User A', FALSE, [
        'mail' => 'unique@example.com',
    ]);
    $this->createUser([], 'User B', FALSE, [
        'mail' => 'UNIQUE@example.com',
    ]);
    $output = \user_requirements('runtime');
    $this->assertArrayHasKey('conflicting emails', $output);
}

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