appName = 'Api'; $app->dbPool = $GLOBALS['dbpool']; $app->router = new WebRouter(); $app->dispatcher = new Dispatcher($app); $app->appSettings = new class() implements SettingsInterface { use OptionsTrait; public function get( mixed $ids = null, string | array $names = null, int $app = null, string $module = null, int $group = null, int $account = null ) : mixed { return ''; } public function set(array $options, bool $store = false) : void {} public function save(array $options = []) : void {} public function create(array $options = []) : void {} }; $app->moduleManager = new ModuleManager($app, __DIR__ . '/../../../Modules/'); $this->appManager = new ApplicationManager($app); } /** * @covers phpOMS\Application\ApplicationManager * @covers phpOMS\Application\InstallerAbstract * @covers phpOMS\Application\StatusAbstract * @group framework */ public function testInstall() : void { self::assertTrue($this->appManager->install(__DIR__ . '/Testapp', __DIR__ . '/Apps/Testapp')); self::assertTrue(\is_dir(__DIR__ . '/Apps/Testapp')); self::assertTrue(\is_file(__DIR__ . '/Apps/Testapp/css/styles.css')); $apps = $this->appManager->getInstalledApplications(false, __DIR__ . '/Apps'); self::assertTrue(isset($apps['Testapp'])); $providing = $this->appManager->getProvidingForModule('Navigation'); Directory::delete(__DIR__ . '/Apps/Testapp'); self::assertTrue(isset($providing['Testapp'])); self::assertTrue(\in_array('Navigation', $providing['Testapp'])); } /** * @covers phpOMS\Application\ApplicationManager * @group framework */ public function testInvalidSourceDestinationInstallPath() : void { self::assertFalse($this->appManager->install(__DIR__ . '/invalid', __DIR__)); self::assertFalse($this->appManager->install(__DIR__, __DIR__)); } /** * @covers phpOMS\Application\ApplicationManager * @group framework */ public function testMissingApplicationInfoFile() : void { self::assertFalse($this->appManager->install(__DIR__, __DIR__ . '/newapp', __DIR__ . '/Apps/newapp')); } }