[Pkg-owncloud-commits] [owncloud] 99/153: Add test case for getValueForUsers()
David Prévot
taffit at moszumanska.debian.org
Tue May 27 03:05:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 457a4aa4255799836bcd2138509323d567114d1b
Author: Joas Schilling <nickvergessen at gmx.de>
Date: Wed May 21 11:34:26 2014 +0200
Add test case for getValueForUsers()
---
tests/lib/preferences.php | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tests/lib/preferences.php b/tests/lib/preferences.php
index f1f6ed0..2f15f47 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);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list