mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-09 07:04:27 +02:00
Add Addon::getId() method
This commit is contained in:
parent
66fb982124
commit
1f25fe9bf5
8 changed files with 89 additions and 25 deletions
|
@ -29,11 +29,11 @@ class AddonManagerTest extends TestCase
|
|||
|
||||
public function testGetAllSubscribedEventsReturnsEvents(): void
|
||||
{
|
||||
$addon = $this->createMock(Addon::class);
|
||||
$addon->expects($this->once())->method('getSubscribedEvents')->willReturn([[HtmlFilterEvent::PAGE_END, [Addon::class, 'onPageEnd']]]);
|
||||
$addon = $this->createStub(Addon::class);
|
||||
$addon->method('getSubscribedEvents')->willReturn([[HtmlFilterEvent::PAGE_END, [Addon::class, 'onPageEnd']]]);
|
||||
|
||||
$loader = $this->createMock(AddonLoader::class);
|
||||
$loader->expects($this->once())->method('getAddons')->willReturn(['helloaddon' => $addon]);
|
||||
$loader = $this->createStub(AddonLoader::class);
|
||||
$loader->method('getAddons')->willReturn(['helloaddon' => $addon]);
|
||||
|
||||
$manager = new AddonManager($loader);
|
||||
|
||||
|
@ -44,4 +44,23 @@ class AddonManagerTest extends TestCase
|
|||
$manager->getAllSubscribedEvents()
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetRequiredDependenciesReturnsArray(): void
|
||||
{
|
||||
$addon = $this->createStub(Addon::class);
|
||||
$addon->method('getId')->willReturn('helloaddon');
|
||||
$addon->method('getRequiredDependencies')->willReturn(['foo', 'bar']);
|
||||
|
||||
$loader = $this->createStub(AddonLoader::class);
|
||||
$loader->method('getAddons')->willReturn(['helloaddon' => $addon]);
|
||||
|
||||
$manager = new AddonManager($loader);
|
||||
|
||||
$manager->bootstrapAddons(['helloaddon' => []]);
|
||||
|
||||
$this->assertSame(
|
||||
['helloaddon' => ['foo', 'bar']],
|
||||
$manager->getRequiredDependencies()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue