diff options
Diffstat (limited to 'tests/lib/AllConfigTest.php')
-rw-r--r-- | tests/lib/AllConfigTest.php | 22 |
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); + } } |