Addon::initAddon() should call bootstrap only once

This commit is contained in:
Art4 2025-01-03 13:18:34 +00:00
parent b47fc318a5
commit a85343dbed
2 changed files with 21 additions and 0 deletions

View file

@ -67,6 +67,19 @@ class AddonProxyTest extends TestCase
$addon->initAddon([]);
}
public function testInitAddonMultipleTimesWillCallBootstrapOnce(): void
{
$bootstrap = $this->createMock(AddonBootstrap::class);
$bootstrap->expects($this->once())->method('initAddon')->willReturnCallback(function ($event) {
$this->assertInstanceOf(AddonStartEvent::class, $event);
});
$addon = new AddonProxy($bootstrap);
$addon->initAddon([]);
$addon->initAddon([]);
}
public function testInitAddonCallsBootstrapWithDependencies(): void
{
$bootstrap = $this->createMock(AddonBootstrap::class);