Move Addon class into Service namespace

This commit is contained in:
Art4 2025-01-03 09:28:21 +00:00
parent 5647d8aef4
commit 92505dca7b
5 changed files with 7 additions and 7 deletions

View file

@ -1,58 +0,0 @@
<?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\Addon;
use Friendica\Addon\Addon;
use Friendica\Addon\AddonBootstrap;
use Friendica\Addon\Event\AddonStartEvent;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
class AddonTest extends TestCase
{
public function testCreateWithAddonBootstrap(): void
{
$bootstrap = $this->createMock(AddonBootstrap::class);
$addon = new Addon($bootstrap);
$this->assertInstanceOf(Addon::class, $addon);
}
public function testInitAddonCallsBootstrap(): void
{
$bootstrap = $this->createMock(AddonBootstrap::class);
$bootstrap->expects($this->once())->method('initAddon')->willReturnCallback(function($event) {
$this->assertInstanceOf(AddonStartEvent::class, $event);
});
$addon = new Addon($bootstrap);
$addon->initAddon([]);
}
public function testInitAddonCallsBootstrapWithDependencies(): void
{
$bootstrap = $this->createMock(AddonBootstrap::class);
$bootstrap->expects($this->once())->method('initAddon')->willReturnCallback(function(AddonStartEvent $event) {
$dependencies = $event->getDependencies();
$this->assertArrayHasKey(LoggerInterface::class, $dependencies);
$this->assertInstanceOf(LoggerInterface::class, $dependencies[LoggerInterface::class]);
});
$addon = new Addon($bootstrap);
$addon->initAddon(
[LoggerInterface::class => $this->createMock(LoggerInterface::class)]
);
}
}