summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-12-16 17:22:44 +0100
committerVincent Petry <pvince81@owncloud.com>2013-12-20 17:16:57 +0100
commitc6377e9125ed2a1b508dd1d2e12db8a82934f648 (patch)
treeaab0af147b0d806c43dd3de9fc446bceca1f934c /tests
parentdc45141f4abfedb10d6f908143b7a75e1ada6406 (diff)
downloadnextcloud-server-c6377e9125ed2a1b508dd1d2e12db8a82934f648.tar.gz
nextcloud-server-c6377e9125ed2a1b508dd1d2e12db8a82934f648.zip
Fixed apps loading order
On SQLite the app order can be arbitrary and cause strange bugs. On MySQL, the app order seems to be always alphabetical. This fix enforces alphabetical order to make sure that all environments behave the same and to reduce bugs related to app loading order. Fixes #6442
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/app.php13
-rw-r--r--tests/lib/appconfig.php2
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/lib/app.php b/tests/lib/app.php
index 52eade90a6e..49f40f089bb 100644
--- a/tests/lib/app.php
+++ b/tests/lib/app.php
@@ -79,4 +79,17 @@ class Test_App extends PHPUnit_Framework_TestCase {
$this->assertFalse(OC_App::isAppVersionCompatible($oc, $app));
}
+ /**
+ * Tests that the app order is correct
+ */
+ public function testGetEnabledAppsIsSorted() {
+ $apps = \OC_App::getEnabledApps(true);
+ // copy array
+ $sortedApps = $apps;
+ sort($sortedApps);
+ // 'files' is always on top
+ unset($sortedApps[array_search('files', $sortedApps)]);
+ array_unshift($sortedApps, 'files');
+ $this->assertEquals($sortedApps, $apps);
+ }
}
diff --git a/tests/lib/appconfig.php b/tests/lib/appconfig.php
index 4d82cd5ba7b..23dd2549e32 100644
--- a/tests/lib/appconfig.php
+++ b/tests/lib/appconfig.php
@@ -35,7 +35,7 @@ class Test_Appconfig extends PHPUnit_Framework_TestCase {
}
public function testGetApps() {
- $query = \OC_DB::prepare('SELECT DISTINCT `appid` FROM `*PREFIX*appconfig`');
+ $query = \OC_DB::prepare('SELECT DISTINCT `appid` FROM `*PREFIX*appconfig` ORDER BY `appid`');
$result = $query->execute();
$expected = array();
while ($row = $result->fetchRow()) {