aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/App/AppManagerTest.php
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2023-09-28 10:55:52 +0200
committerGitHub <noreply@github.com>2023-09-28 10:55:52 +0200
commitc9ed1e981bb0493cd02a4fcccfb299dcd847e618 (patch)
tree51a96cc7da5006b32f878479762f11ba23c45550 /tests/lib/App/AppManagerTest.php
parent99e287b49abaa1c0807a5bb6e7bae6d6f764f82d (diff)
parent8049702413f4422ea299733c8f69b852732edcb2 (diff)
downloadnextcloud-server-c9ed1e981bb0493cd02a4fcccfb299dcd847e618.tar.gz
nextcloud-server-c9ed1e981bb0493cd02a4fcccfb299dcd847e618.zip
Merge pull request #40617 from nextcloud/enh/allow-user-to-set-apporder
Read apporder from configuration value
Diffstat (limited to 'tests/lib/App/AppManagerTest.php')
-rw-r--r--tests/lib/App/AppManagerTest.php32
1 files changed, 28 insertions, 4 deletions
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php
index 3bf2195499f..73ac7b79909 100644
--- a/tests/lib/App/AppManagerTest.php
+++ b/tests/lib/App/AppManagerTest.php
@@ -607,21 +607,43 @@ class AppManagerTest extends TestCase {
// none specified, default to files
[
'',
+ '',
+ '{}',
'files',
],
// unexisting or inaccessible app specified, default to files
[
'unexist',
+ '',
+ '{}',
'files',
],
// non-standard app
[
'settings',
+ '',
+ '{}',
'settings',
],
// non-standard app with fallback
[
'unexist,settings',
+ '',
+ '{}',
+ 'settings',
+ ],
+ // user-customized defaultapp
+ [
+ 'unexist,settings',
+ 'files',
+ '{"settings":[1],"files":[2]}',
+ 'files',
+ ],
+ // user-customized apporder fallback
+ [
+ '',
+ '',
+ '{"settings":[1],"files":[2]}',
'settings',
],
];
@@ -630,7 +652,7 @@ class AppManagerTest extends TestCase {
/**
* @dataProvider provideDefaultApps
*/
- public function testGetDefaultAppForUser($defaultApps, $expectedApp) {
+ public function testGetDefaultAppForUser($defaultApps, $userDefaultApps, $userApporder, $expectedApp) {
$user = $this->newUser('user1');
$this->userSession->expects($this->once())
@@ -642,10 +664,12 @@ class AppManagerTest extends TestCase {
->with('defaultapp', $this->anything())
->willReturn($defaultApps);
- $this->config->expects($this->once())
+ $this->config->expects($this->atLeastOnce())
->method('getUserValue')
- ->with('user1', 'core', 'defaultapp')
- ->willReturn('');
+ ->willReturnMap([
+ ['user1', 'core', 'defaultapp', '', $userDefaultApps],
+ ['user1', 'core', 'apporder', '[]', $userApporder],
+ ]);
$this->assertEquals($expectedApp, $this->manager->getDefaultAppForUser());
}