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 /tests/lib/AllConfigTest.php
parent4461b9e870d9d97e1cf83f2adfdeb09cd57c3e18 (diff)
use specific email getter where necessary
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests/lib/AllConfigTest.php')
-rw-r--r--tests/lib/AllConfigTest.php22
1 files changed, 21 insertions, 1 deletions
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);
+ }
}