createMock(AddonBootstrap::class); $addon = new AddonProxy($bootstrap); $this->assertInstanceOf(Addon::class, $addon); } public function testGetRequiredDependenciesCallsBootstrap(): void { $bootstrap = $this->createMock(AddonBootstrap::class); $bootstrap->expects($this->once())->method('getRequiredDependencies')->willReturn([]); $addon = new AddonProxy($bootstrap); $addon->getRequiredDependencies(); } public function testGetProvidedDependencyRulesCallsBootstrap(): void { $bootstrap = $this->createMock(CombinedAddonBootstrapDependencyProvider::class); $bootstrap->expects($this->once())->method('provideDependencyRules')->willReturn([]); $addon = new AddonProxy($bootstrap); $addon->getProvidedDependencyRules(); } 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 AddonProxy($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 AddonProxy($bootstrap); $addon->initAddon( [LoggerInterface::class => $this->createMock(LoggerInterface::class)] ); } }