From 76c3eeb96e47000f5dfa1e4d88d1e2c6f4b56b2b Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 24 Mar 2025 08:54:38 +0000 Subject: [PATCH] Register hooks as event listener in API tests --- tests/ApiTestCase.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/ApiTestCase.php b/tests/ApiTestCase.php index 6124bf9f32..45a84c280a 100644 --- a/tests/ApiTestCase.php +++ b/tests/ApiTestCase.php @@ -11,6 +11,7 @@ use Friendica\Capabilities\ICanCreateResponses; use Friendica\Core\Addon\AddonHelper; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Hook; +use Friendica\Core\Hooks\HookEventBridge; use Friendica\DI; use Friendica\Module\Special\HTTPException; use Friendica\Security\Authentication; @@ -159,6 +160,13 @@ abstract class ApiTestCase extends FixtureTestCase ; DI::init($this->dice); + /** @var \Friendica\Event\EventDispatcher */ + $eventDispatcher = DI::eventDispatcher(); + + foreach (HookEventBridge::getStaticSubscribedEvents() as $eventName => $methodName) { + $eventDispatcher->addListener($eventName, [HookEventBridge::class, $methodName]); + } + $this->httpExceptionMock = $this->dice->create(HTTPException::class); AuthTestConfig::$authenticated = true;