summaryrefslogtreecommitdiffstats
path: root/tests/lib/App
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2023-03-29 13:36:45 -0700
committerChristopher Ng <chrng8@gmail.com>2023-03-29 13:36:45 -0700
commit4f8e916585889b99247d967d51325ac0c840ec59 (patch)
tree67e9b24aa50f033cf88d52f53b648bb2bd30aab4 /tests/lib/App
parentfc371facd202d7ede86f1adb37fc78a8c478deff (diff)
downloadnextcloud-server-4f8e916585889b99247d967d51325ac0c840ec59.tar.gz
nextcloud-server-4f8e916585889b99247d967d51325ac0c840ec59.zip
Add label for logo link
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'tests/lib/App')
-rw-r--r--tests/lib/App/AppManagerTest.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php
index bf9592ac6a6..3518ada3314 100644
--- a/tests/lib/App/AppManagerTest.php
+++ b/tests/lib/App/AppManagerTest.php
@@ -617,4 +617,47 @@ class AppManagerTest extends TestCase {
$this->assertEquals([], $this->manager->getAppRestriction('test2'));
$this->assertEquals(['foo'], $this->manager->getAppRestriction('test3'));
}
+
+ public function provideDefaultApps(): array {
+ return [
+ // 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',
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider provideDefaultApps
+ */
+ public function testGetDefaultAppForUser($defaultApps, $expectedApp) {
+ $user = $this->newUser('user1');
+
+ $this->userSession->expects($this->once())
+ ->method('getUser')
+ ->willReturn($user);
+
+ $this->config->expects($this->once())
+ ->method('getSystemValueString')
+ ->with('defaultapp', $this->anything())
+ ->willReturn($defaultApps);
+
+ $this->assertEquals($expectedApp, $this->manager->getDefaultAppForUser());
+ }
}