Implement register subscribed events from addons

This commit is contained in:
Art4 2025-01-03 14:04:15 +00:00
parent a85343dbed
commit 57ddf69d1c
6 changed files with 77 additions and 7 deletions

View file

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace Friendica\Test\Unit\Service\Addon;
use Friendica\Event\HtmlFilterEvent;
use Friendica\Service\Addon\AddonManager;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
@ -27,4 +28,22 @@ class AddonManagerTest extends TestCase
$manager->bootstrapAddons(['helloaddon' => []]);
}
public function testGetAllSubscribedEventsReturnsEvents(): void
{
$logger = $this->createMock(LoggerInterface::class);
$logger->expects($this->once())->method('info')->with('Addon "helloaddon" loaded.');
$manager = new AddonManager(
dirname(__DIR__, 3) . '/Util',
$logger
);
$manager->bootstrapAddons(['helloaddon' => []]);
$this->assertSame(
[[HtmlFilterEvent::PAGE_END, ['', 'onPageEnd']]],
$manager->getAllSubscribedEvents()
);
}
}