mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-09 07:04:27 +02:00
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
// Copyright (C) 2010-2024, the Friendica project
|
|
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
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;
|
|
|
|
class AddonManagerTest extends TestCase
|
|
{
|
|
public function testBootstrapAddonsLoadsTheAddon(): 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' => []]);
|
|
}
|
|
|
|
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()
|
|
);
|
|
}
|
|
}
|