Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2021-09-01 16:41:02 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2021-09-09 20:23:05 +0300
commit27865d03c014e3b644408c32967cc7e7a56bf692 (patch)
treee5017ad43d75dac165cb98cdbbe65a04877a6dba
parent4461b9e870d9d97e1cf83f2adfdeb09cd57c3e18 (diff)
use specific email getter where necessary
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php7
-rw-r--r--apps/dav/lib/DAV/GroupPrincipalBackend.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php34
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php2
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php8
-rw-r--r--apps/provisioning_api/lib/Controller/AUserData.php2
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php2
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php13
-rw-r--r--apps/settings/lib/Controller/UsersController.php4
-rw-r--r--apps/settings/tests/Controller/UsersControllerTest.php9
-rw-r--r--apps/user_ldap/lib/User/User.php2
-rw-r--r--core/Command/User/Info.php2
-rw-r--r--core/Command/User/ListCommand.php2
-rw-r--r--lib/private/Collaboration/Collaborators/UserPlugin.php4
-rw-r--r--tests/lib/AllConfigTest.php22
15 files changed, 67 insertions, 48 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php
index 4a422fa9628..8002f963798 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -300,16 +300,13 @@ class Principal implements BackendInterface {
if (!$allowEnumeration) {
if ($allowEnumerationFullMatch) {
$users = $this->userManager->getByEmail($value);
- $users = \array_filter($users, static function (IUser $user) use ($value) {
- return $user->getEMailAddress() === $value;
- });
} else {
$users = [];
}
} else {
$users = $this->userManager->getByEmail($value);
$users = \array_filter($users, function (IUser $user) use ($currentUser, $value, $limitEnumerationPhone, $limitEnumerationGroup, $allowEnumerationFullMatch, $currentUserGroups) {
- if ($allowEnumerationFullMatch && $user->getEMailAddress() === $value) {
+ if ($allowEnumerationFullMatch && $user->getSystemEMailAddress() === $value) {
return true;
}
@@ -516,7 +513,7 @@ class Principal implements BackendInterface {
'{http://nextcloud.com/ns}language' => $this->languageFactory->getUserLanguage($user),
];
- $email = $user->getEMailAddress();
+ $email = $user->getSystemEMailAddress();
if (!empty($email)) {
$principal['{http://sabredav.org/ns}email-address'] = $email;
}
diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php
index 34ac26d7d97..6317fc59cc2 100644
--- a/apps/dav/lib/DAV/GroupPrincipalBackend.php
+++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php
@@ -331,7 +331,7 @@ class GroupPrincipalBackend implements BackendInterface {
'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL',
];
- $email = $user->getEMailAddress();
+ $email = $user->getSystemEMailAddress();
if (!empty($email)) {
$principal['{http://sabredav.org/ns}email-address'] = $email;
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
index ba65edf2dd1..d7c074c9e3b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
@@ -120,7 +120,7 @@ class PrincipalTest extends TestCase {
->willReturn('Dr. Foo-Bar');
$fooUser
->expects($this->once())
- ->method('getEMailAddress')
+ ->method('getSystemEMailAddress')
->willReturn('');
$barUser = $this->createMock(User::class);
$barUser
@@ -129,7 +129,7 @@ class PrincipalTest extends TestCase {
->willReturn('bar');
$barUser
->expects($this->once())
- ->method('getEMailAddress')
+ ->method('getSystemEMailAddress')
->willReturn('bar@nextcloud.com');
$this->userManager
->expects($this->once())
@@ -205,7 +205,7 @@ class PrincipalTest extends TestCase {
$fooUser = $this->createMock(User::class);
$fooUser
->expects($this->once())
- ->method('getEMailAddress')
+ ->method('getSystemEMailAddress')
->willReturn('foo@nextcloud.com');
$fooUser
->expects($this->once())
@@ -605,15 +605,15 @@ class PrincipalTest extends TestCase {
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
$user2->method('getDisplayName')->willReturn('User 2');
- $user2->method('getEMailAddress')->willReturn('user2@foo.bar');
+ $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar');
$user3 = $this->createMock(IUser::class);
$user3->method('getUID')->willReturn('user3');
$user2->method('getDisplayName')->willReturn('User 22');
- $user2->method('getEMailAddress')->willReturn('user2@foo.bar123');
+ $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar123');
$user4 = $this->createMock(IUser::class);
$user4->method('getUID')->willReturn('user4');
$user2->method('getDisplayName')->willReturn('User 222');
- $user2->method('getEMailAddress')->willReturn('user2@foo.bar456');
+ $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar456');
$this->userManager->expects($this->at(0))
->method('searchDisplayName')
@@ -665,20 +665,20 @@ class PrincipalTest extends TestCase {
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
$user2->method('getDisplayName')->willReturn('User 2');
- $user2->method('getEMailAddress')->willReturn('user2@foo.bar');
+ $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar');
$user3 = $this->createMock(IUser::class);
$user3->method('getUID')->willReturn('user3');
$user2->method('getDisplayName')->willReturn('User 22');
- $user2->method('getEMailAddress')->willReturn('user2@foo.bar123');
+ $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar123');
$user4 = $this->createMock(IUser::class);
$user4->method('getUID')->willReturn('user4');
$user2->method('getDisplayName')->willReturn('User 222');
- $user2->method('getEMailAddress')->willReturn('user2@foo.bar456');
+ $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar456');
- $this->userManager->expects($this->at(0))
+ $this->userManager->expects($this->once())
->method('getByEmail')
->with('user2@foo.bar')
- ->willReturn([$user2, $user3, $user4]);
+ ->willReturn([$user2]);
$this->assertEquals(['principals/users/user2'], $this->connector->searchPrincipals('principals/users',
['{http://sabredav.org/ns}email-address' => 'user2@foo.bar']));
@@ -726,15 +726,15 @@ class PrincipalTest extends TestCase {
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
$user2->method('getDisplayName')->willReturn('User 2');
- $user2->method('getEMailAddress')->willReturn('user2@foo.bar');
+ $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar');
$user3 = $this->createMock(IUser::class);
$user3->method('getUID')->willReturn('user3');
$user3->method('getDisplayName')->willReturn('User 22');
- $user3->method('getEMailAddress')->willReturn('user2@foo.bar123');
+ $user3->method('getSystemEMailAddress')->willReturn('user2@foo.bar123');
$user4 = $this->createMock(IUser::class);
$user4->method('getUID')->willReturn('user4');
$user4->method('getDisplayName')->willReturn('User 222');
- $user4->method('getEMailAddress')->willReturn('user2@foo.bar456');
+ $user4->method('getSystemEMailAddress')->willReturn('user2@foo.bar456');
$this->userSession->expects($this->at(0))
@@ -787,15 +787,15 @@ class PrincipalTest extends TestCase {
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
$user2->method('getDisplayName')->willReturn('User 2');
- $user2->method('getEMailAddress')->willReturn('user2@foo.bar');
+ $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar');
$user3 = $this->createMock(IUser::class);
$user3->method('getUID')->willReturn('user3');
$user3->method('getDisplayName')->willReturn('User 22');
- $user3->method('getEMailAddress')->willReturn('user2@foo.bar123');
+ $user3->method('getSystemEMailAddress')->willReturn('user2@foo.bar123');
$user4 = $this->createMock(IUser::class);
$user4->method('getUID')->willReturn('user4');
$user4->method('getDisplayName')->willReturn('User 222');
- $user4->method('getEMailAddress')->willReturn('user2@foo.bar456');
+ $user4->method('getSystemEMailAddress')->willReturn('user2@foo.bar456');
$this->userSession->expects($this->at(0))
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 668bbb7cca8..c9853f1e12c 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -238,7 +238,7 @@ class ShareAPIController extends OCSController {
$result['share_with'] = $share->getSharedWith();
$result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith();
$result['share_with_displayname_unique'] = $sharedWith !== null ? (
- $sharedWith->getEMailAddress() !== '' ? $sharedWith->getEMailAddress() : $sharedWith->getUID()
+ !empty($sharedWith->getSystemEMailAddress()) ? $sharedWith->getSystemEMailAddress() : $sharedWith->getUID()
) : $share->getSharedWith();
$result['status'] = [];
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index 411496f7a27..86a7d479899 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -47,6 +47,7 @@ use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
use OCP\Files\Storage;
use OCP\IConfig;
+use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IPreview;
@@ -785,7 +786,7 @@ class ShareAPIControllerTest extends TestCase {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->method('getUID')->willReturn('userId');
$user->method('getDisplayName')->willReturn('userDisplay');
- $user->method('getEMailAddress')->willReturn('userId@example.com');
+ $user->method('getSystemEMailAddress')->willReturn('userId@example.com');
$group = $this->getMockBuilder('OCP\IGroup')->getMock();
$group->method('getGID')->willReturn('groupId');
@@ -3586,7 +3587,7 @@ class ShareAPIControllerTest extends TestCase {
$initiator->method('getDisplayName')->willReturn('initiatorDN');
$recipient = $this->getMockBuilder(IUser::class)->getMock();
$recipient->method('getDisplayName')->willReturn('recipientDN');
- $recipient->method('getEmailAddress')->willReturn('recipient');
+ $recipient->method('getSystemEMailAddress')->willReturn('recipient');
$result = [];
@@ -4387,7 +4388,7 @@ class ShareAPIControllerTest extends TestCase {
public function testFormatShare(array $expects, \OCP\Share\IShare $share, array $users, $exception) {
$this->userManager->method('get')->willReturnMap($users);
- $recipientGroup = $this->createMock('\OCP\IGroup');
+ $recipientGroup = $this->createMock(IGroup::class);
$recipientGroup->method('getDisplayName')->willReturn('recipientGroupDisplayName');
$this->groupManager->method('get')->willReturnMap([
['recipientGroup', $recipientGroup],
@@ -4397,7 +4398,6 @@ class ShareAPIControllerTest extends TestCase {
->with('files_sharing.sharecontroller.showShare', ['token' => 'myToken'])
->willReturn('myLink');
-
$this->rootFolder->method('getUserFolder')
->with($this->currentUser)
->willReturnSelf();
diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php
index 83ad887be77..5bb62f2b7dc 100644
--- a/apps/provisioning_api/lib/Controller/AUserData.php
+++ b/apps/provisioning_api/lib/Controller/AUserData.php
@@ -153,7 +153,7 @@ abstract class AUserData extends OCSController {
$data[IAccountManager::PROPERTY_AVATAR . self::SCOPE_SUFFIX] = $userAccount->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope();
}
- $data[IAccountManager::PROPERTY_EMAIL] = $targetUserObject->getEMailAddress();
+ $data[IAccountManager::PROPERTY_EMAIL] = $targetUserObject->getSystemEMailAddress();
if ($includeScopes) {
$data[IAccountManager::PROPERTY_EMAIL . self::SCOPE_SUFFIX] = $userAccount->getProperty(IAccountManager::PROPERTY_EMAIL)->getScope();
}
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index e91d234809c..af7c641f01a 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -873,7 +873,7 @@ class UsersController extends AUserData {
}
break;
case IAccountManager::COLLECTION_EMAIL:
- if (filter_var($value, FILTER_VALIDATE_EMAIL) && $value !== $targetUser->getEMailAddress()) {
+ if (filter_var($value, FILTER_VALIDATE_EMAIL) && $value !== $targetUser->getSystemEMailAddress()) {
$userAccount = $this->accountManager->getAccount($targetUser);
$mailCollection = $userAccount->getPropertyCollection(IAccountManager::COLLECTION_EMAIL);
foreach ($mailCollection->getProperties() as $property) {
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index cc638c89a63..7ae5d0c245f 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -952,7 +952,7 @@ class UsersControllerTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$targetUser->expects($this->once())
- ->method('getEMailAddress')
+ ->method('getSystemEMailAddress')
->willReturn('demo@nextcloud.com');
$this->userSession
->expects($this->once())
@@ -1067,6 +1067,7 @@ class UsersControllerTest extends TestCase {
'setPassword' => true,
],
'additional_mail' => [],
+ 'notify_email' => null,
];
$this->assertEquals($expected, $this->invokePrivate($this->api, 'getUserData', ['UID']));
}
@@ -1083,9 +1084,9 @@ class UsersControllerTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$targetUser
- ->expects($this->once())
- ->method('getEMailAddress')
- ->willReturn('demo@nextcloud.com');
+ ->expects($this->once())
+ ->method('getSystemEMailAddress')
+ ->willReturn('demo@nextcloud.com');
$this->userSession
->expects($this->once())
->method('getUser')
@@ -1195,6 +1196,7 @@ class UsersControllerTest extends TestCase {
'setPassword' => true,
],
'additional_mail' => [],
+ 'notify_email' => null,
];
$this->assertEquals($expected, $this->invokePrivate($this->api, 'getUserData', ['UID']));
}
@@ -1306,7 +1308,7 @@ class UsersControllerTest extends TestCase {
->willReturn('Subadmin User');
$targetUser
->expects($this->once())
- ->method('getEMailAddress')
+ ->method('getSystemEMailAddress')
->willReturn('subadmin@nextcloud.com');
$targetUser
->method('getUID')
@@ -1361,6 +1363,7 @@ class UsersControllerTest extends TestCase {
'setPassword' => false,
],
'additional_mail' => [],
+ 'notify_email' => null,
];
$this->assertEquals($expected, $this->invokePrivate($this->api, 'getUserData', ['UID']));
}
diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php
index f78fa7dd9b8..6be93d6a3a0 100644
--- a/apps/settings/lib/Controller/UsersController.php
+++ b/apps/settings/lib/Controller/UsersController.php
@@ -482,7 +482,7 @@ class UsersController extends Controller {
}
}
- $oldEmailAddress = $userAccount->getUser()->getEMailAddress();
+ $oldEmailAddress = $userAccount->getUser()->getSystemEMailAddress();
$oldEmailAddress = strtolower((string)$oldEmailAddress);
if ($oldEmailAddress !== $userAccount->getProperty(IAccountManager::PROPERTY_EMAIL)->getValue()) {
// this is the only permission a backend provides and is also used
@@ -490,7 +490,7 @@ class UsersController extends Controller {
if (!$userAccount->getUser()->canChangeDisplayName()) {
throw new ForbiddenException($this->l10n->t('Unable to change email address'));
}
- $userAccount->getUser()->setEMailAddress($userAccount->getProperty(IAccountManager::PROPERTY_EMAIL)->getValue());
+ $userAccount->getUser()->setSystemEMailAddress($userAccount->getProperty(IAccountManager::PROPERTY_EMAIL)->getValue());
}
try {
diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php
index 7faca378cdf..797fa1621fa 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -621,16 +621,15 @@ class UsersControllerTest extends \Test\TestCase {
$user = $this->createMock(IUser::class);
$user->method('getDisplayName')->willReturn($oldDisplayName);
- $user->method('getEMailAddress')->willReturn($oldEmailAddress);
+ $user->method('getSystemEMailAddress')->willReturn($oldEmailAddress);
$user->method('canChangeDisplayName')->willReturn(true);
if ($data[IAccountManager::PROPERTY_EMAIL]['value'] === $oldEmailAddress ||
($oldEmailAddress === null && $data[IAccountManager::PROPERTY_EMAIL]['value'] === '')) {
- $user->expects($this->never())->method('setEMailAddress');
+ $user->expects($this->never())->method('setSystemEMailAddress');
} else {
- $user->expects($this->once())->method('setEMailAddress')
- ->with($data[IAccountManager::PROPERTY_EMAIL]['value'])
- ->willReturn(true);
+ $user->expects($this->once())->method('setSystemEMailAddress')
+ ->with($data[IAccountManager::PROPERTY_EMAIL]['value']);
}
if ($data[IAccountManager::PROPERTY_DISPLAYNAME]['value'] === $oldDisplayName ||
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 7d57fcbb275..b09fbd18327 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -448,7 +448,7 @@ class User {
if ($email !== '') {
$user = $this->userManager->get($this->uid);
if (!is_null($user)) {
- $currentEmail = (string)$user->getEMailAddress();
+ $currentEmail = (string)$user->getSystemEMailAddress();
if ($currentEmail !== $email) {
$user->setEMailAddress($email);
}
diff --git a/core/Command/User/Info.php b/core/Command/User/Info.php
index 377b722d293..abc8938ed54 100644
--- a/core/Command/User/Info.php
+++ b/core/Command/User/Info.php
@@ -76,7 +76,7 @@ class Info extends Base {
$data = [
'user_id' => $user->getUID(),
'display_name' => $user->getDisplayName(),
- 'email' => $user->getEMailAddress() ? $user->getEMailAddress() : '',
+ 'email' => (string)$user->getSystemEMailAddress(),
'cloud_id' => $user->getCloudId(),
'enabled' => $user->isEnabled(),
'groups' => $groups,
diff --git a/core/Command/User/ListCommand.php b/core/Command/User/ListCommand.php
index 3a2708d4da2..20422afbf9d 100644
--- a/core/Command/User/ListCommand.php
+++ b/core/Command/User/ListCommand.php
@@ -104,7 +104,7 @@ class ListCommand extends Base {
return [
'user_id' => $user->getUID(),
'display_name' => $user->getDisplayName(),
- 'email' => $user->getEMailAddress() ? $user->getEMailAddress() : '',
+ 'email' => (string)$user->getSystemEMailAddress(),
'cloud_id' => $user->getCloudId(),
'enabled' => $user->isEnabled(),
'groups' => $groups,
diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php
index e3e4b37f383..9ed94082f0d 100644
--- a/lib/private/Collaboration/Collaborators/UserPlugin.php
+++ b/lib/private/Collaboration/Collaborators/UserPlugin.php
@@ -157,7 +157,7 @@ class UserPlugin implements ISearchPlugin {
$userStatuses = $this->userStatusManager->getUserStatuses(array_keys($users));
foreach ($users as $uid => $user) {
$userDisplayName = $user->getDisplayName();
- $userEmail = $user->getEMailAddress();
+ $userEmail = $user->getSystemEMailAddress();
$uid = (string) $uid;
$status = [];
@@ -244,7 +244,7 @@ class UserPlugin implements ISearchPlugin {
if ($addUser) {
$status = [];
$uid = $user->getUID();
- $userEmail = $user->getEMailAddress();
+ $userEmail = $user->getSystemEMailAddress();
if (array_key_exists($user->getUID(), $userStatuses)) {
$userStatus = $userStatuses[$user->getUID()];
$status = [
diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php
index 9daa7c9be9c..b0b0b7eff8b 100644
--- a/tests/lib/AllConfigTest.php
+++ b/tests/lib/AllConfigTest.php
@@ -15,6 +15,8 @@ namespace Test;
*
* @package Test
*/
+
+use OC\SystemConfig;
use OCP\IDBConnection;
class AllConfigTest extends \Test\TestCase {
@@ -145,7 +147,7 @@ class AllConfigTest extends \Test\TestCase {
$config->setUserValue('userSetBool', 'appSetBool', 'keySetBool', $value);
}
-
+
public function testSetUserValueWithPreConditionFailure() {
$this->expectException(\OCP\PreConditionNotMetException::class);
@@ -437,4 +439,22 @@ class AllConfigTest extends \Test\TestCase {
// cleanup
$this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`');
}
+
+ public function testGetUsersForUserValueCaseInsensitive() {
+ // mock the check for the database to run the correct SQL statements for each database type
+ $systemConfig = $this->createMock(SystemConfig::class);
+ $systemConfig->expects($this->once())
+ ->method('getValue')
+ ->with($this->equalTo('dbtype'), $this->equalTo('sqlite'))
+ ->willReturn(\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite'));
+ $config = $this->getConfig($systemConfig);
+
+ $config->setUserValue('user1', 'myApp', 'myKey', 'test123');
+ $config->setUserValue('user2', 'myApp', 'myKey', 'TEST123');
+ $config->setUserValue('user3', 'myApp', 'myKey', 'test12345');
+
+ $users = $config->getUsersForUserValueCaseInsensitive('myApp', 'myKey', 'test123');
+ $this->assertSame(2, count($users));
+ $this->assertSame(['user1', 'user2'], $users);
+ }
}