diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-06-05 16:52:00 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-06-05 16:52:00 +0200 |
commit | 4b650a20a42b70412cee9dd835e096e16da6d530 (patch) | |
tree | d9e774571b0b870fcf4488b72b384ea9b63a0f1e /tests | |
parent | 9e84a0a1af1d49b37c0539dc417440f29fc45611 (diff) | |
parent | d493c0c9aca4f1286084798f293b3097b16e9d0e (diff) | |
download | nextcloud-server-4b650a20a42b70412cee9dd835e096e16da6d530.tar.gz nextcloud-server-4b650a20a42b70412cee9dd835e096e16da6d530.zip |
Merge pull request #8893 from owncloud/feature/get-users-by-preference
Add method to get users by their preference
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/preferences.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lib/preferences.php b/tests/lib/preferences.php index 499be914fb7..93c9704f6c6 100644 --- a/tests/lib/preferences.php +++ b/tests/lib/preferences.php @@ -221,6 +221,24 @@ class Test_Preferences_Object extends PHPUnit_Framework_TestCase { $this->assertEquals('someothervalue', $values['AnotherUser']); } + public function testGetValueUsers() + { + // Prepare data + $query = \OC_DB::prepare('INSERT INTO `*PREFIX*preferences` VALUES(?, ?, ?, ?)'); + $query->execute(array('SomeUser', 'testGetUsersForValue', 'somekey', 'somevalue')); + $query->execute(array('AnotherUser', 'testGetUsersForValue', 'somekey', 'someothervalue')); + $query->execute(array('AUser', 'testGetUsersForValue', 'somekey', 'somevalue')); + + $preferences = new OC\Preferences(\OC_DB::getConnection()); + $result = $preferences->getUsersForValue('testGetUsersForValue', 'somekey', 'somevalue'); + sort($result); + $this->assertEquals(array('AUser', 'SomeUser'), $result); + + // Clean DB after the test + $query = \OC_DB::prepare('DELETE FROM `*PREFIX*preferences` WHERE `appid` = ?'); + $query->execute(array('testGetUsersForValue')); + } + public function testDeleteKey() { $connectionMock = $this->getMock('\OC\DB\Connection', array(), array(), '', false); |