Skip to content

Commit db7cab9

Browse files
committed
test(app): cover search provider registration
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent e5aae6c commit db7cab9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/php/Unit/AppInfo/ApplicationTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use OCA\ProfileFields\Listener\RegisterWorkflowCheckListener;
1515
use OCA\ProfileFields\Listener\RegisterWorkflowEntityListener;
1616
use OCA\ProfileFields\Listener\RegisterWorkflowOperationListener;
17+
use OCA\ProfileFields\Search\ProfileFieldSearchProvider;
1718
use OCP\AppFramework\Bootstrap\IBootContext;
1819
use OCP\AppFramework\Bootstrap\IRegistrationContext;
1920
use OCP\IRequest;
@@ -27,8 +28,14 @@
2728
class ApplicationTest extends TestCase {
2829
public function testRegisterAddsWorkflowListeners(): void {
2930
$registrations = [];
31+
$searchProviders = [];
3032

3133
$registrationContext = $this->createMock(IRegistrationContext::class);
34+
$registrationContext->expects($this->once())
35+
->method('registerSearchProvider')
36+
->willReturnCallback(static function (string $provider) use (&$searchProviders): void {
37+
$searchProviders[] = $provider;
38+
});
3239
$registrationContext->expects($this->exactly(6))
3340
->method('registerEventListener')
3441
->willReturnCallback(static function (string $event, string $listener, int $priority = 0) use (&$registrations): void {
@@ -38,6 +45,7 @@ public function testRegisterAddsWorkflowListeners(): void {
3845
$application = new Application();
3946
$application->register($registrationContext);
4047

48+
self::assertContains(ProfileFieldSearchProvider::class, $searchProviders);
4149
self::assertContains(['\\OCA\\Settings\\Events\\BeforeTemplateRenderedEvent', 'OCA\\ProfileFields\\Listener\\BeforeTemplateRenderedListener', 0], $registrations);
4250
self::assertContains([UserDeletedEvent::class, 'OCA\\ProfileFields\\Listener\\UserDeletedCleanupListener', 0], $registrations);
4351
self::assertContains([RegisterEntitiesEvent::class, RegisterWorkflowEntityListener::class, 0], $registrations);

0 commit comments

Comments
 (0)