]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add unit test for case insensitive email saving 35804/head
authorVincent Petry <vincent@nextcloud.com>
Fri, 16 Dec 2022 16:47:18 +0000 (17:47 +0100)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Fri, 16 Dec 2022 21:56:05 +0000 (21:56 +0000)
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
apps/settings/tests/Controller/UsersControllerTest.php

index 797fa1621fa82330b77a97731cdf4e05cbd2cacb..ba7d9689130c89dddef49c778c0c64d38e9b2c21 100644 (file)
@@ -624,7 +624,7 @@ class UsersControllerTest extends \Test\TestCase {
                $user->method('getSystemEMailAddress')->willReturn($oldEmailAddress);
                $user->method('canChangeDisplayName')->willReturn(true);
 
-               if ($data[IAccountManager::PROPERTY_EMAIL]['value'] === $oldEmailAddress ||
+               if (strtolower($data[IAccountManager::PROPERTY_EMAIL]['value']) === strtolower($oldEmailAddress) ||
                        ($oldEmailAddress === null && $data[IAccountManager::PROPERTY_EMAIL]['value'] === '')) {
                        $user->expects($this->never())->method('setSystemEMailAddress');
                } else {
@@ -720,6 +720,14 @@ class UsersControllerTest extends \Test\TestCase {
                                'john@example.com',
                                null
                        ],
+                       [
+                               [
+                                       IAccountManager::PROPERTY_EMAIL => ['value' => 'john@example.com'],
+                                       IAccountManager::PROPERTY_DISPLAYNAME => ['value' => 'john doe'],
+                               ],
+                               'JOHN@example.com',
+                               null
+                       ],
 
                ];
        }