diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-02-18 11:20:16 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-02-18 11:21:39 +0100 |
commit | b6f44e9a1d2c6c733249430067147cad46a37481 (patch) | |
tree | c12db44292ce5cf2adc92c1b2fc84cb5c77eb654 /tests/lib/preferences.php | |
parent | 323cc1166be3545ed841c1cbafa29a3bcf7614aa (diff) | |
download | nextcloud-server-b6f44e9a1d2c6c733249430067147cad46a37481.tar.gz nextcloud-server-b6f44e9a1d2c6c733249430067147cad46a37481.zip |
Add caching to OC\Preferences
Diffstat (limited to 'tests/lib/preferences.php')
-rw-r--r-- | tests/lib/preferences.php | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/tests/lib/preferences.php b/tests/lib/preferences.php index a8236909ded..f1f6ed08003 100644 --- a/tests/lib/preferences.php +++ b/tests/lib/preferences.php @@ -144,58 +144,6 @@ class Test_Preferences_Object extends PHPUnit_Framework_TestCase { $this->assertEquals(array('foo'), $apps); } - public function testGetApps() - { - $statementMock = $this->getMock('\Doctrine\DBAL\Statement', array(), array(), '', false); - $statementMock->expects($this->exactly(2)) - ->method('fetchColumn') - ->will($this->onConsecutiveCalls('foo', false)); - $connectionMock = $this->getMock('\OC\DB\Connection', array(), array(), '', false); - $connectionMock->expects($this->once()) - ->method('executeQuery') - ->with($this->equalTo('SELECT DISTINCT `appid` FROM `*PREFIX*preferences` WHERE `userid` = ?'), - $this->equalTo(array('bar'))) - ->will($this->returnValue($statementMock)); - - $preferences = new OC\Preferences($connectionMock); - $apps = $preferences->getApps('bar'); - $this->assertEquals(array('foo'), $apps); - } - - public function testGetKeys() - { - $statementMock = $this->getMock('\Doctrine\DBAL\Statement', array(), array(), '', false); - $statementMock->expects($this->exactly(2)) - ->method('fetchColumn') - ->will($this->onConsecutiveCalls('foo', false)); - $connectionMock = $this->getMock('\OC\DB\Connection', array(), array(), '', false); - $connectionMock->expects($this->once()) - ->method('executeQuery') - ->with($this->equalTo('SELECT `configkey` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?'), - $this->equalTo(array('bar', 'moo'))) - ->will($this->returnValue($statementMock)); - - $preferences = new OC\Preferences($connectionMock); - $keys = $preferences->getKeys('bar', 'moo'); - $this->assertEquals(array('foo'), $keys); - } - - public function testGetValue() - { - $connectionMock = $this->getMock('\OC\DB\Connection', array(), array(), '', false); - $connectionMock->expects($this->exactly(2)) - ->method('fetchAssoc') - ->with($this->equalTo('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'), - $this->equalTo(array('grg', 'bar', 'red'))) - ->will($this->onConsecutiveCalls(array('configvalue'=>'foo'), null)); - - $preferences = new OC\Preferences($connectionMock); - $value = $preferences->getValue('grg', 'bar', 'red'); - $this->assertEquals('foo', $value); - $value = $preferences->getValue('grg', 'bar', 'red', 'def'); - $this->assertEquals('def', $value); - } - public function testSetValue() { $connectionMock = $this->getMock('\OC\DB\Connection', array(), array(), '', false); |