From 4f8e916585889b99247d967d51325ac0c840ec59 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Wed, 29 Mar 2023 13:36:45 -0700 Subject: Add label for logo link Signed-off-by: Christopher Ng --- tests/lib/App/AppManagerTest.php | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'tests/lib/App/AppManagerTest.php') 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()); + } } -- cgit v1.2.3