Skip to content
Snippets Groups Projects
Verified Commit 95d3d95f authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3490639 by dcam, seanb: Checking for duplicate emails in...

Issue #3490639 by dcam, seanb: Checking for duplicate emails in user_requirements() does not take langcode into account
parent 4a6a0bc3
Branches
No related tags found
4 merge requests!12628#3524738 backport without deprecation,!12477#3532243: JSON support status during updates,!5423Draft: Resolve #3329907 "Test2",!213Issue #2906496: Give Media a menu item under Content
Pipeline #535666 canceled
Pipeline: drupal

#535667

    ......@@ -49,6 +49,7 @@ public function runtime(): array {
    $query->addExpression('LOWER(mail)', 'lower_mail');
    $query->isNotNull('mail');
    $query->groupBy('lower_mail');
    $query->groupBy('langcode');
    $query->having('COUNT(uid) > :matches', [':matches' => 1]);
    $conflicts = $query->countQuery()->execute()->fetchField();
    ......
    ......@@ -5,6 +5,7 @@
    namespace Drupal\Tests\user\Kernel;
    use Drupal\KernelTests\KernelTestBase;
    use Drupal\language\Entity\ConfigurableLanguage;
    use Drupal\Tests\user\Traits\UserCreationTrait;
    /**
    ......@@ -70,4 +71,21 @@ public function testBlankUserEmails(): void {
    $this->assertArrayNotHasKey('conflicting emails', $output);
    }
    /**
    * Tests that the requirements check does not flag user translations.
    */
    public function testTranslatedUserEmail(): void {
    \Drupal::service('module_installer')->install(['language']);
    ConfigurableLanguage::createFromLangcode('is')->save();
    $output = $this->moduleHandler->invoke('user', 'runtime_requirements');
    $this->assertArrayNotHasKey('conflicting emails', $output);
    $user = $this->createUser([], 'User A', FALSE, ['mail' => 'unique@example.com']);
    $user->addTranslation('is')->save();
    $output = $this->moduleHandler->invoke('user', 'runtime_requirements');
    $this->assertArrayNotHasKey('conflicting emails', $output);
    }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment