diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-05-21 11:34:26 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-05-21 11:36:01 +0200 |
commit | 457a4aa4255799836bcd2138509323d567114d1b (patch) | |
tree | 978ebe2315078f468877b546d078a1e84ea6fd26 /tests | |
parent | cf3cd572b0410e6db7255e3373c8ec8230c4af5c (diff) | |
download | nextcloud-server-457a4aa4255799836bcd2138509323d567114d1b.tar.gz nextcloud-server-457a4aa4255799836bcd2138509323d567114d1b.zip |
Add test case for getValueForUsers()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/preferences.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/preferences.php b/tests/lib/preferences.php index f1f6ed08003..2f15f47ea14 100644 --- a/tests/lib/preferences.php +++ b/tests/lib/preferences.php @@ -184,6 +184,25 @@ class Test_Preferences_Object extends PHPUnit_Framework_TestCase { $preferences->setValue('grg', 'bar', 'foo', 'v2'); } + public function testGetUserValues() + { + $query = \OC_DB::prepare('INSERT INTO `*PREFIX*preferences` VALUES(?, ?, ?, ?)'); + $query->execute(array('SomeUser', 'testGetUserValues', 'somekey', 'somevalue')); + $query->execute(array('AnotherUser', 'testGetUserValues', 'somekey', 'someothervalue')); + $query->execute(array('AUser', 'testGetUserValues', 'somekey', 'somevalue')); + + $preferences = new OC\Preferences(\OC_DB::getConnection()); + $values = $preferences->getValueForUsers('testGetUserValues', 'somekey', array('SomeUser', 'AnotherUser', 'NoValueSet')); + + $this->assertEquals(2, sizeof($values)); + + $this->assertArrayHasKey('SomeUser', $values); + $this->assertEquals('somevalue', $values['SomeUser']); + + $this->assertArrayHasKey('AnotherUser', $values); + $this->assertEquals('someothervalue', $values['AnotherUser']); + } + public function testDeleteKey() { $connectionMock = $this->getMock('\OC\DB\Connection', array(), array(), '', false); |