[Pkg-owncloud-commits] [owncloud] 90/258: Don't rely on the sorting the database gives us for tests

David Prévot taffit at moszumanska.debian.org
Sat Oct 11 17:22:24 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 8580e2a697c38fefcd98d890dac9b2402511c4cf
Author: Robin Appelman <icewind at owncloud.com>
Date:   Fri Jun 6 10:24:28 2014 +0200

    Don't rely on the sorting the database gives us for tests
---
 tests/lib/preferences-singleton.php | 16 ++++++++++++----
 tests/lib/preferences.php           |  1 -
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/tests/lib/preferences-singleton.php b/tests/lib/preferences-singleton.php
index 17fe54a..2fde089 100644
--- a/tests/lib/preferences-singleton.php
+++ b/tests/lib/preferences-singleton.php
@@ -44,7 +44,10 @@ class Test_Preferences extends PHPUnit_Framework_TestCase {
 			$expected[] = $row['userid'];
 		}
 
-		$this->assertEquals($expected, \OC_Preferences::getUsers());
+		sort($expected);
+		$users = \OC_Preferences::getUsers();
+		sort($users);
+		$this->assertEquals($expected, $users);
 	}
 
 	public function testGetApps() {
@@ -55,8 +58,10 @@ class Test_Preferences extends PHPUnit_Framework_TestCase {
 			$expected[] = $row['appid'];
 		}
 
-		$this->assertEquals($expected, \OC_Preferences::getApps('Someuser'));
-	}
+		sort($expected);
+		$apps = \OC_Preferences::getApps('Someuser');
+		sort($apps);
+		$this->assertEquals($expected, $apps);	}
 
 	public function testGetKeys() {
 		$query = \OC_DB::prepare('SELECT DISTINCT `configkey` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?');
@@ -66,7 +71,10 @@ class Test_Preferences extends PHPUnit_Framework_TestCase {
 			$expected[] = $row['configkey'];
 		}
 
-		$this->assertEquals($expected, \OC_Preferences::getKeys('Someuser', 'getkeysapp'));
+		sort($expected);
+		$keys = \OC_Preferences::getKeys('Someuser', 'getkeysapp');
+		sort($keys);
+		$this->assertEquals($expected, $keys);
 	}
 
 	public function testGetValue() {
diff --git a/tests/lib/preferences.php b/tests/lib/preferences.php
index fe8e3e8..f2117ec 100644
--- a/tests/lib/preferences.php
+++ b/tests/lib/preferences.php
@@ -6,7 +6,6 @@
  * later.
  * See the COPYING-README file.
  */
-
 class Test_Preferences_Object extends PHPUnit_Framework_TestCase {
 	public function testGetUsers()
 	{

-- 
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