diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-09-01 15:41:02 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-09-09 19:23:05 +0200 |
commit | 27865d03c014e3b644408c32967cc7e7a56bf692 (patch) | |
tree | e5017ad43d75dac165cb98cdbbe65a04877a6dba /tests | |
parent | 4461b9e870d9d97e1cf83f2adfdeb09cd57c3e18 (diff) | |
download | nextcloud-server-27865d03c014e3b644408c32967cc7e7a56bf692.tar.gz nextcloud-server-27865d03c014e3b644408c32967cc7e7a56bf692.zip |
use specific email getter where necessary
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests')
-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); + } } |