diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2024-12-17 20:11:19 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2024-12-18 12:50:11 +0100 |
commit | 13fefc4612f1f894bef95c4b061058196d68a9f2 (patch) | |
tree | 833b62cb37cd30bdf489e2a51666720c1bdbd099 /tests | |
parent | fe90aa3ffe0a8127a92cf0226333c44ed5b793dc (diff) | |
download | nextcloud-server-13fefc4612f1f894bef95c4b061058196d68a9f2.tar.gz nextcloud-server-13fefc4612f1f894bef95c4b061058196d68a9f2.zip |
feat(Navigation): emit dedicated event for loading additional entriesenh/noid/navigationentryevent
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/NavigationManagerTest.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php index 7767a8c2e8f..d9db928e8a1 100644 --- a/tests/lib/NavigationManagerTest.php +++ b/tests/lib/NavigationManagerTest.php @@ -11,6 +11,7 @@ use OC\App\AppManager; use OC\Group\Manager; use OC\NavigationManager; use OC\SubAdmin; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IGroupManager; use OCP\IL10N; @@ -18,6 +19,8 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserSession; use OCP\L10N\IFactory; +use OCP\Navigation\Events\LoadAdditionalEntriesEvent; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; class NavigationManagerTest extends TestCase { @@ -34,6 +37,8 @@ class NavigationManagerTest extends TestCase { /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ protected $config; + protected IEVentDispatcher|MockObject $dispatcher; + /** @var \OC\NavigationManager */ protected $navigationManager; protected LoggerInterface $logger; @@ -48,6 +53,7 @@ class NavigationManagerTest extends TestCase { $this->groupManager = $this->createMock(Manager::class); $this->config = $this->createMock(IConfig::class); $this->logger = $this->createMock(LoggerInterface::class); + $this->dispatcher = $this->createMock(IEventDispatcher::class); $this->navigationManager = new NavigationManager( $this->appManager, $this->urlGenerator, @@ -56,6 +62,7 @@ class NavigationManagerTest extends TestCase { $this->groupManager, $this->config, $this->logger, + $this->dispatcher, ); $this->navigationManager->clear(false); @@ -256,6 +263,11 @@ class NavigationManagerTest extends TestCase { $this->groupManager->expects($this->any())->method('getSubAdmin')->willReturn($subadmin); $this->navigationManager->clear(); + $this->dispatcher->expects($this->once()) + ->method('dispatchTyped') + ->willReturnCallback(function ($event) { + $this->assertInstanceOf(LoadAdditionalEntriesEvent::class, $event); + }); $entries = $this->navigationManager->getAll('all'); $this->assertEquals($expected, $entries); } @@ -558,6 +570,11 @@ class NavigationManagerTest extends TestCase { $this->groupManager->expects($this->any())->method('getSubAdmin')->willReturn($subadmin); $this->navigationManager->clear(); + $this->dispatcher->expects($this->once()) + ->method('dispatchTyped') + ->willReturnCallback(function ($event) { + $this->assertInstanceOf(LoadAdditionalEntriesEvent::class, $event); + }); $entries = $this->navigationManager->getAll(); $this->assertEquals($expected, $entries); } |