From 5339e6115a016c36afae82b7ff4fb9637d0d5ee3 Mon Sep 17 00:00:00 2001 From: "Misha M.-Kupriyanov" Date: Tue, 29 Jul 2025 16:31:57 +0200 Subject: [PATCH] test(SearchComposerTest): add unit tests for SearchComposer Signed-off-by: Misha M.-Kupriyanov --- tests/lib/Search/SearchComposerTest.php | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/lib/Search/SearchComposerTest.php diff --git a/tests/lib/Search/SearchComposerTest.php b/tests/lib/Search/SearchComposerTest.php new file mode 100644 index 00000000000..c47e86bad2b --- /dev/null +++ b/tests/lib/Search/SearchComposerTest.php @@ -0,0 +1,61 @@ +bootstrapCoordinator = $this->createMock(Coordinator::class); + $this->container = $this->createMock(ContainerInterface::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); + $this->logger = $this->createMock(LoggerInterface::class); + $this->appConfig = $this->createMock(IAppConfig::class); + + $this->searchComposer = new SearchComposer( + $this->bootstrapCoordinator, + $this->container, + $this->urlGenerator, + $this->logger, + $this->appConfig + ); + } + + private function setupEmptyRegistrationContext(): void { + $this->bootstrapCoordinator->expects($this->once()) + ->method('getRegistrationContext') + ->willReturn(null); + } + + public function testGetProvidersWithNoRegisteredProviders(): void { + $this->setupEmptyRegistrationContext(); + + $providers = $this->searchComposer->getProviders('/test/route', []); + + $this->assertIsArray($providers); + $this->assertEmpty($providers); + } +}