From: Vincent Petry Date: Fri, 16 Dec 2022 16:47:18 +0000 (+0100) Subject: Add unit test for case insensitive email saving X-Git-Tag: v24.0.9rc1~25^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=28aaa5aefcfaa0d3e4058172898bff6100a3e3e4;p=nextcloud-server.git Add unit test for case insensitive email saving Signed-off-by: Vincent Petry --- diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index 797fa1621fa..ba7d9689130 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -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 + ], ]; }