Add unit test for case insensitive email saving

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
Vincent Petry 2022-12-16 17:47:18 +01:00 committed by backportbot-nextcloud[bot]
parent b813d05272
commit bf4f0d37f8

View 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
],
];
}