Let AddonFactory implement AddonLoader

This commit is contained in:
Art4 2025-01-04 10:05:29 +00:00
parent 1067b2a23a
commit 247e9c5fba
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,21 @@
<?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\Service\Addon;
/**
* Interface for an addon loader.
*/
interface AddonLoader
{
/**
* @return Addon[] Returns an array of Addon instances.
*/
public function getAddons(array $addonNames): array;
}

View file

@ -11,11 +11,22 @@ namespace Friendica\Test\Unit\Service\Addon;
use Friendica\Service\Addon\Addon;
use Friendica\Service\Addon\AddonFactory;
use Friendica\Service\Addon\AddonLoader;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
class AddonFactoryTest extends TestCase
{
public function testAddonFactoryImplementsAddonLoaderInterface(): void
{
$factory = new AddonFactory(
dirname(__DIR__, 3) . '/Util',
$this->createMock(LoggerInterface::class)
);
$this->assertInstanceOf(AddonLoader::class, $factory);
}
public function testLoadAddonsLoadsTheAddon(): void
{
$logger = $this->createMock(LoggerInterface::class);