From e9d4036389097708a6075d8882c32b1c7db4fb0f Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 25 Sep 2023 14:21:23 +0200 Subject: feat(theming): Allow to configure default apps and app order in frontend settings * Also add API for setting the value using ajax. * Add cypress tests for app order and defaul apps Signed-off-by: Ferdinand Thiessen --- tests/lib/App/AppManagerTest.php | 58 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) (limited to 'tests/lib/App') diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index 73ac7b79909..104b0941644 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -609,20 +609,47 @@ class AppManagerTest extends TestCase { '', '', '{}', + true, 'files', ], + // none specified, without fallback + [ + '', + '', + '{}', + false, + '', + ], // unexisting or inaccessible app specified, default to files [ 'unexist', '', '{}', + true, 'files', ], + // unexisting or inaccessible app specified, without fallbacks + [ + 'unexist', + '', + '{}', + false, + '', + ], // non-standard app [ 'settings', '', '{}', + true, + 'settings', + ], + // non-standard app, without fallback + [ + 'settings', + '', + '{}', + false, 'settings', ], // non-standard app with fallback @@ -630,13 +657,31 @@ class AppManagerTest extends TestCase { 'unexist,settings', '', '{}', + true, 'settings', ], // user-customized defaultapp + [ + '', + 'files', + '', + true, + 'files', + ], + // user-customized defaultapp with systemwide + [ + 'unexist,settings', + 'files', + '', + true, + 'files', + ], + // user-customized defaultapp with system wide and apporder [ 'unexist,settings', 'files', '{"settings":[1],"files":[2]}', + true, 'files', ], // user-customized apporder fallback @@ -644,15 +689,24 @@ class AppManagerTest extends TestCase { '', '', '{"settings":[1],"files":[2]}', + true, 'settings', ], + // user-customized apporder, but called without fallback + [ + '', + '', + '{"settings":[1],"files":[2]}', + false, + '', + ], ]; } /** * @dataProvider provideDefaultApps */ - public function testGetDefaultAppForUser($defaultApps, $userDefaultApps, $userApporder, $expectedApp) { + public function testGetDefaultAppForUser($defaultApps, $userDefaultApps, $userApporder, $withFallbacks, $expectedApp) { $user = $this->newUser('user1'); $this->userSession->expects($this->once()) @@ -671,6 +725,6 @@ class AppManagerTest extends TestCase { ['user1', 'core', 'apporder', '[]', $userApporder], ]); - $this->assertEquals($expectedApp, $this->manager->getDefaultAppForUser()); + $this->assertEquals($expectedApp, $this->manager->getDefaultAppForUser(null, $withFallbacks)); } } -- cgit v1.2.3