Skip to content
Snippets Groups Projects
Commit 457a4aa4 authored by Joas Schilling's avatar Joas Schilling
Browse files

Add test case for getValueForUsers()

parent cf3cd572
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment