diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/NavigationManagerTest.php | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php index 91da970f3b9..48cfa972f2b 100644 --- a/tests/lib/NavigationManagerTest.php +++ b/tests/lib/NavigationManagerTest.php @@ -704,30 +704,64 @@ class NavigationManagerTest extends TestCase { true, 'settings', ], + // closure navigation entries are also resolved + [ + 'closure2', + '', + '', + true, + 'closure2', + ], + [ + '', + 'closure2', + '', + true, + 'closure2', + ], + [ + '', + '', + '{"closure2":{"order":1,"app":"closure2","href":"/closure2"}}', + true, + 'closure2', + ], ]; } /** * @dataProvider provideDefaultEntries */ - public function testGetDefaultEntryIdForUser($defaultApps, $userDefaultApps, $userApporder, $withFallbacks, $expectedApp): void { + public function testGetDefaultEntryIdForUser(string $defaultApps, string $userDefaultApps, string $userApporder, bool $withFallbacks, string $expectedApp): void { $this->navigationManager->add([ 'id' => 'files', ]); $this->navigationManager->add([ 'id' => 'settings', ]); + $this->navigationManager->add(static function (): array { + return [ + 'id' => 'closure1', + 'href' => '/closure1', + ]; + }); + $this->navigationManager->add(static function (): array { + return [ + 'id' => 'closure2', + 'href' => '/closure2', + ]; + }); $this->appManager->method('getEnabledApps')->willReturn([]); $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('user1'); - $this->userSession->expects($this->once()) + $this->userSession->expects($this->atLeastOnce()) ->method('getUser') ->willReturn($user); - $this->config->expects($this->once()) + $this->config->expects($this->atLeastOnce()) ->method('getSystemValueString') ->with('defaultapp', $this->anything()) ->willReturn($defaultApps); |