appManager = $this->createMock(IAppManager::class); $this->serverContainer = $this->createMock(IServerContainer::class); $this->crashReporterRegistry = $this->createMock(Registry::class); $this->dashboardManager = $this->createMock(IManager::class); $this->eventDispatcher = $this->createMock(IEventDispatcher::class); $this->eventLogger = $this->createMock(IEventLogger::class); $this->logger = $this->createMock(LoggerInterface::class); $this->coordinator = new Coordinator( $this->serverContainer, $this->crashReporterRegistry, $this->dashboardManager, $this->eventDispatcher, $this->eventLogger, $this->appManager, $this->logger, ); } public function testBootAppNotLoadable(): void { $appId = 'settings'; $this->serverContainer->expects($this->once()) ->method('query') ->with(\OCA\Settings\AppInfo\Application::class) ->willThrowException(new QueryException('')); $this->logger->expects($this->once()) ->method('error'); $this->coordinator->bootApp($appId); } public function testBootAppNotBootable(): void { $appId = 'settings'; $mockApp = $this->createMock(\OCA\Settings\AppInfo\Application::class); $this->serverContainer->expects($this->once()) ->method('query') ->with(\OCA\Settings\AppInfo\Application::class) ->willReturn($mockApp); $this->coordinator->bootApp($appId); } public function testBootApp(): void { $appId = 'settings'; $mockApp = new class extends App implements IBootstrap { public function __construct() { parent::__construct('test', []); } public function register(IRegistrationContext $context): void { } public function boot(IBootContext $context): void { } }; $this->serverContainer->expects($this->once()) ->method('query') ->with(\OCA\Settings\AppInfo\Application::class) ->willReturn($mockApp); $this->coordinator->bootApp($appId); } }