Skip to content

Commit

Permalink
Add unit test for case insensitive email saving
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 authored and backportbot-nextcloud[bot] committed Dec 16, 2022
1 parent ff6279e commit 28aaa5a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/settings/tests/Controller/UsersControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ public function testSaveUserSettings($data,
$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 {
Expand Down Expand Up @@ -720,6 +720,14 @@ public function dataTestSaveUserSettings() {
'john@example.com',
null
],
[
[
IAccountManager::PROPERTY_EMAIL => ['value' => 'john@example.com'],
IAccountManager::PROPERTY_DISPLAYNAME => ['value' => 'john doe'],
],
'JOHN@example.com',
null
],

];
}
Expand Down

0 comments on commit 28aaa5a

Please sign in to comment.