Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add unit test for case insensitive email saving
Signed-off-by: Vincent Petry <[email protected]>
  • Loading branch information
PVince81 authored and backportbot-nextcloud[bot] committed Dec 16, 2022
commit f9a269b25a685bbb3e69f20df416615cc8b0bb54
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() {
'[email protected]',
null
],
[
[
IAccountManager::PROPERTY_EMAIL => ['value' => '[email protected]'],
IAccountManager::PROPERTY_DISPLAYNAME => ['value' => 'john doe'],
],
'[email protected]',
null
],

];
}
Expand Down