diff --git a/gulliver/system/class.headPublisher.php b/gulliver/system/class.headPublisher.php index a1e455ae4..5cc0e0861 100644 --- a/gulliver/system/class.headPublisher.php +++ b/gulliver/system/class.headPublisher.php @@ -554,7 +554,7 @@ class headPublisher //hook for registered javascripts from plugins if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined('SYS_SYS')) { - $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton(); + $oPluginRegistry = PluginRegistry::loadSingleton(); $pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename); } else { $pluginJavascripts = array(); diff --git a/tests/WorkflowTestCase.php b/tests/WorkflowTestCase.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/LanguageTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/LanguageTest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Plugins/PluginsRegistryTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Plugins/PluginsRegistryTest.php deleted file mode 100644 index 73090068d..000000000 --- a/tests/unit/workflow/engine/src/ProcessMaker/Plugins/PluginsRegistryTest.php +++ /dev/null @@ -1,1323 +0,0 @@ -oPluginRegistry = new PluginsRegistry(); - $this->oPluginRegistry->setupPlugins(); - } - - /** - * This is the default method to test, if the class still having - * the same number of methods. - */ - public function testNumberOfMethodsInThisClass() - { - $methods = get_class_methods('\ProcessMaker\Plugins\PluginsRegistry'); - $this->assertTrue(count($methods) == 82, count($methods)); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::__construct - */ - public function testConstruct() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('__construct', $methods), 'exists method __construct'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', '__construct'); - $r->getParameters(); - } - - /** - * Test get Plugins - */ - public function testGetPlugins() - { - $this->assertObjectHasAttribute('Plugins', $this->oPluginRegistry, 'Plugins attribute does not exist'); - $this->assertEquals([], $this->oPluginRegistry->getPlugins(), 'The Plugins attribute is not an array'); - } - - /** - * Test set Plugins - */ - public function testSetPlugins() - { - $this->assertObjectHasAttribute('Plugins', $this->oPluginRegistry, 'Plugins attribute does not exist'); - $this->oPluginRegistry->setPlugins([]); - $this->assertEquals([], $this->oPluginRegistry->getPlugins(), 'The Plugins attribute is not an array'); - } - - /** - * Test load singleton of database - */ - public function testLoadSingleton() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $this->assertObjectHasAttribute('Plugins', $oPluginRegistry, 'Plugins attribute does not exist'); - $this->assertInstanceOf(Plugins::class, $oPluginRegistry, ''); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerPlugin - */ - public function testRegisterPluginParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerPlugin', $methods), 'exists method registerPlugin'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerPlugin'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sFilename'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == true); - $this->assertTrue($params[1]->getDefaultValue() == ''); - } - - /** - * Test registry plugin - */ - public function testRegisterPlugin() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $pluginFile = 'enterprise.php'; - //add the plugin php file - require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php"); - //register mulitenant in the plugin registry singleton, because details are read from this instance - $oPluginRegistry->registerPlugin("enterprise", $pluginFile); - $this->assertObjectHasAttribute('_aPluginDetails', $oPluginRegistry, 'Plugins attribute does not exist'); - $this->assertInstanceOf(PluginDetail::class, $oPluginRegistry->_aPluginDetails['enterprise'], ''); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::getPluginDetails - */ - public function testGetPluginDetailsParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('getPluginDetails', $methods), 'exists method getPluginDetails'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'getPluginDetails'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sFilename'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * Test get plugin details - */ - public function testGetPluginDetails() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $pluginFile = 'enterprise.php'; - //add the plugin php file - require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php"); - //register mulitenant in the plugin registry singleton, because details are read from this instance - $details = $oPluginRegistry->getPluginDetails($pluginFile); - $this->assertEquals('enterprise', $details->sNamespace, 'Namespace attribute does not equals'); - $this->assertObjectHasAttribute('sNamespace', $details, 'sNamespace attribute does not exist'); - $this->assertInstanceOf(PluginDetail::class, $details, ''); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::enablePlugin - */ - public function testEnablePluginParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('enablePlugin', $methods), 'exists method enablePlugin'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'enablePlugin'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * Test enable plugin - */ - public function testEnablePlugin() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $pluginFile = 'enterprise.php'; - //add the plugin php file - require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php"); - //register mulitenant in the plugin registry singleton, because details are read from this instance - $details = $oPluginRegistry->getPluginDetails($pluginFile); - $this->assertEquals(false, $details->enabled, 'Not disable Plugin'); - $result = $oPluginRegistry->enablePlugin($details->sNamespace); - $this->assertEquals(true, $result, 'Plugin is enable'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::disablePlugin - */ - public function testDisablePluginParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('disablePlugin', $methods), 'exists method disablePlugin'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'disablePlugin'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'eventPlugin'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == true); - $this->assertTrue($params[1]->getDefaultValue() == '1'); - } - - /** - * Test disable plugin - */ - public function testDisablePlugin() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $pluginFile = 'enterprise.php'; - //add the plugin php file - require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php"); - //register mulitenant in the plugin registry singleton, because details are read from this instance - $details = $oPluginRegistry->getPluginDetails($pluginFile); - $result = $oPluginRegistry->enablePlugin($details->sNamespace); - $this->assertEquals(true, $result, 'Plugin is enable'); - $oPluginRegistry->disablePlugin($details->sNamespace); - $details = $oPluginRegistry->getPluginDetails($pluginFile); - $this->assertEquals(false, $details->enabled, 'Plugin is enable'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::getStatusPlugin - */ - public function testGetStatusPluginParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('getStatusPlugin', $methods), 'exists method getStatusPlugin'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'getStatusPlugin'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'name'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * Test get status plugin - */ - public function testGetStatusPlugin() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $pluginFile = 'enterprise.php'; - //add the plugin php file - require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php"); - //register mulitenant in the plugin registry singleton, because details are read from this instance - $details = $oPluginRegistry->getPluginDetails($pluginFile); - $result = $oPluginRegistry->getStatusPlugin($pluginFile); - $this->assertEquals(false, $result, 'Plugin is enabled'); - $oPluginRegistry->enablePlugin($details->sNamespace); - $details = $oPluginRegistry->getPluginDetails($pluginFile); - $this->assertEquals(true, $details->enabled, 'Plugin is disabled'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::installPluginArchive - */ - public function testInstallPluginArchiveParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('installPluginArchive', $methods), 'exists method installPluginArchive'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'installPluginArchive'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'filename'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'pluginName'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::uninstallPlugin - */ - public function testUninstallPluginParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('uninstallPlugin', $methods), 'exists method uninstallPlugin'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'uninstallPlugin'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::uninstallPluginWorkspaces - */ - public function testUninstallPluginWorkspaces() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('uninstallPluginWorkspaces', $methods), 'exists method uninstallPluginWorkspaces'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'uninstallPluginWorkspaces'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'arrayPlugin'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::installPlugin - */ - public function testInstallPlugin() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('installPlugin', $methods), 'exists method installPlugin'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'installPlugin'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerMenu - */ - public function testRegisterMenuParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerMenu', $methods), 'exists method registerMenu'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerMenu'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sMenuId'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'sFilename'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - } - - /** - * Test register menu - */ - public function testRegisterMenu() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerMenu( - "enterprise", - 'setup', - PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php" - ); - $this->assertEquals( - 'enterprise', - $oPluginRegistry->_aMenus[0]->sNamespace, - 'Namespace attribute does not equals' - ); - $this->assertObjectHasAttribute('sMenuId', $oPluginRegistry->_aMenus[0], 'sMenuId attribute does not exist'); - $this->assertInstanceOf(MenuDetail::class, $oPluginRegistry->_aMenus[0], ''); - $oPluginRegistry->registerMenu( - "enterprise", - 'setup', - PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php" - ); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerDashlets - */ - public function testRegisterDashletsParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerDashlets', $methods), 'exists method registerDashlets'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerDashlets'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'namespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * Test register dashlets - */ - public function testRegisterDashlets() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerDashlets("enterprise"); - $this->assertEquals( - 'enterprise', - $oPluginRegistry->_aDashlets[0], - 'Namespace attribute does not equals' - ); - $oPluginRegistry->registerDashlets("enterprise"); - $this->assertEquals('enterprise', $oPluginRegistry->_aDashlets[0], 'sMenuId attribute does not exist'); - $this->assertTrue(is_array($oPluginRegistry->_aDashlets)); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerCss - */ - public function testRegisterCssParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerCss', $methods), 'exists method registerCss'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerCss'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sCssFile'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - } - - /** - * Test register Css - */ - public function testRegisterCss() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerCss('enterprise', PATH_CORE . 'css' . PATH_SEP . 'test.css'); - $this->assertEquals( - PATH_CORE . 'css' . PATH_SEP . 'test.css', - $oPluginRegistry->_aCSSStyleSheets[0]->sCssFile, - 'sCssFile attribute does not equals' - ); - $oPluginRegistry->registerCss('enterprise', PATH_CORE . 'css' . PATH_SEP . 'test.css'); - $this->assertObjectHasAttribute( - 'sCssFile', - $oPluginRegistry->_aCSSStyleSheets[0], - 'sCssFile attribute does not exist' - ); - $this->assertInstanceOf(CssFile::class, $oPluginRegistry->_aCSSStyleSheets[0], ''); - } - - /** - * Test get registered css - */ - public function testGetRegisteredCss() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerCss('enterprise', PATH_CORE . 'css' . PATH_SEP . 'test.css'); - $css = $oPluginRegistry->getRegisteredCss(); - $this->assertEquals( - PATH_CORE . 'css' . PATH_SEP . 'test.css', - $css[0]->sCssFile, - 'sCssFile attribute does not equals' - ); - $this->assertObjectHasAttribute( - 'sCssFile', - $css[0], - 'sCssFile attribute does not exist' - ); - $this->assertInstanceOf(CssFile::class, $css[0], ''); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerJavascript - */ - public function testRegisterJavascriptParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerJavascript', $methods), 'exists method registerJavascript'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerJavascript'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sCoreJsFile'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'pluginJsFile'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - } - - /** - * Test register javascript - */ - public function testRegisterJavascript() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore.js', - PATH_PLUGINS . 'js' . PATH_SEP . 'test.js' - ); - $this->assertEquals( - PATH_PLUGINS . 'js' . PATH_SEP . 'test.js', - $oPluginRegistry->_aJavascripts[0]->pluginJsFile[0], - 'sCssFile attribute does not equals' - ); - $js = $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore.js', - PATH_PLUGINS . 'js' . PATH_SEP . 'test.js' - ); - $this->assertEquals( - PATH_PLUGINS . 'js' . PATH_SEP . 'test.js', - $js->pluginJsFile[0], - 'sCssFile attribute does not equals' - ); - // Test send an array - $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore2.js', - [PATH_PLUGINS . 'js' . PATH_SEP . 'test2.js'] - ); - $this->assertEquals( - PATH_PLUGINS . 'js' . PATH_SEP . 'test2.js', - $oPluginRegistry->_aJavascripts[1]->pluginJsFile[0], - 'sCssFile attribute does not equals' - ); - $js = $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore2.js', - [PATH_PLUGINS . 'js' . PATH_SEP . 'test2.js'] - ); - $this->assertEquals( - PATH_PLUGINS . 'js' . PATH_SEP . 'test2.js', - $js->pluginJsFile[0], - 'sCssFile attribute does not equals' - ); - } - - /** - * Test throw register javascript send array - */ - public function testRegisterJavascriptThrowArray() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $this->expectException(\Exception::class); - $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore.js', - true - ); - } - - /** - * Test throw register javascript send string - */ - public function testRegisterJavascriptThrowString() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $this->expectException(\Exception::class); - $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore3.js', - true - ); - } - - /** - * Test get registered javascript - */ - public function testGetRegisteredJavascript() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore2.js', - [PATH_PLUGINS . 'js' . PATH_SEP . 'test2.js'] - ); - $js = $oPluginRegistry->getRegisteredJavascript(); - $this->assertEquals(2, count($js)); - $this->assertObjectHasAttribute( - 'pluginJsFile', - $js[0], - 'pluginJsFile attribute does not exist' - ); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::getRegisteredJavascriptBy - */ - public function testGetRegisteredJavascriptByParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('getRegisteredJavascriptBy', $methods), 'exists method getRegisteredJavascriptBy'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'getRegisteredJavascriptBy'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sCoreJsFile'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sNamespace'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == true); - $this->assertTrue($params[1]->getDefaultValue() == ''); - } - - /** - * Test get registered javascript by path - */ - public function testGetRegisteredJavascriptBy() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore.js', - [PATH_PLUGINS . 'js' . PATH_SEP . 'test.js'] - ); - $js = $oPluginRegistry->getRegisteredJavascriptBy(PATH_CORE . 'js' . PATH_SEP . 'testCore.js'); - $this->assertEquals(PATH_PLUGINS . 'js' . PATH_SEP . 'test.js', $js[0]); - $oPluginRegistry->getRegisteredJavascriptBy(PATH_CORE . 'js' . PATH_SEP . 'testCore.js', 'enterprise'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::unregisterJavascripts - */ - public function testUnregisterJavascriptsParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('unregisterJavascripts', $methods), 'exists method unregisterJavascripts'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'unregisterJavascripts'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sCoreJsFile'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == true); - $this->assertTrue($params[1]->getDefaultValue() == ''); - } - - /** - * Test get unregistered javascript - */ - public function testUnregisterJavascripts() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore.js', - [PATH_PLUGINS . 'js' . PATH_SEP . 'test.js'] - ); - $oPluginRegistry->unregisterJavascripts('enterprise'); - $this->assertEquals(0, count($oPluginRegistry->_aJavascripts)); - $oPluginRegistry->registerJavascript( - 'enterprise', - PATH_CORE . 'js' . PATH_SEP . 'testCore.js', - [PATH_PLUGINS . 'js' . PATH_SEP . 'test.js'] - ); - $oPluginRegistry->unregisterJavascripts('enterprise', PATH_CORE . 'js' . PATH_SEP . 'testCore.js'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerReport - */ - public function testRegisterReportParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerReport', $methods), 'exists method registerReport'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerReport'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * Test register report - */ - public function testRegisterReport() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerReport('enterprise'); - $this->assertEquals(1, count($oPluginRegistry->_aReports)); - $oPluginRegistry->registerReport('enterprise'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerPmFunction - */ - public function testRegisterPmFunctionParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerPmFunction', $methods), 'exists method registerPmFunction'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerPmFunction'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * Test register pmfunction - */ - public function testRegisterPmFunction() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerPmFunction('enterprise'); - $this->assertEquals(1, count($oPluginRegistry->_aPmFunctions)); - $oPluginRegistry->registerPmFunction('enterprise'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerRedirectLogin - */ - public function testRegisterRedirectLoginParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerRedirectLogin', $methods), 'exists method registerRedirectLogin'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerRedirectLogin'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sRole'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'sPathMethod'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - } - - /** - * Test registered redirect login - */ - public function testRegisterRedirectLogin() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerRedirectLogin('enterprise', 'TEST', PATH_CORE . 'js' . PATH_SEP . 'testCore.js'); - $this->assertEquals(1, count($oPluginRegistry->_aRedirectLogin)); - $this->assertInstanceOf(RedirectDetail::class, $oPluginRegistry->_aRedirectLogin[0], ''); - $oPluginRegistry->registerRedirectLogin('enterprise', 'TEST', PATH_CORE . 'js' . PATH_SEP . 'testCore.js'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerFolder - */ - public function testRegisterFolderParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerFolder', $methods), 'exists method registerFolder'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerFolder'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sFolderId'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'sFolderName'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - } - - /** - * Test registered folder - */ - public function testRegisterFolder() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerFolder('enterprise', '1234', 'TestCore'); - $this->assertEquals(2, count($oPluginRegistry->_aFolders)); - $this->assertInstanceOf(FolderDetail::class, $oPluginRegistry->_aFolders[1], ''); - $oPluginRegistry->registerFolder('enterprise', '1234', 'TestCore'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerStep - */ - public function testRegisterStepParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerStep', $methods), 'exists method registerStep'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerStep'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sStepId'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'sStepName'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - $this->assertTrue($params[3]->getName() == 'sStepTitle'); - $this->assertTrue($params[3]->isArray() == false); - $this->assertTrue($params[3]->isOptional() == false); - $this->assertTrue($params[4]->getName() == 'setupStepPage'); - $this->assertTrue($params[4]->isArray() == false); - $this->assertTrue($params[4]->isOptional() == true); - $this->assertTrue($params[4]->getDefaultValue() == ''); - } - - /** - * Test register step - */ - public function testRegisterStep() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerStep('enterprise', '1234', 'TestStep', 'StepTitle'); - $this->assertEquals(1, count($oPluginRegistry->_aSteps)); - $this->assertInstanceOf(StepDetail::class, $oPluginRegistry->_aSteps[0], ''); - $oPluginRegistry->registerStep('enterprise', '1234', 'TestStep', 'StepTitle'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::isRegisteredFolder - */ - public function testIsRegisteredFolderParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('isRegisteredFolder', $methods), 'exists method isRegisteredFolder'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'isRegisteredFolder'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sFolderName'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * Test is registered folder - */ - public function testIsRegisteredFolder() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerFolder('charts', '1234', 'charts'); - $step = $oPluginRegistry->isRegisteredFolder('charts'); - $this->assertTrue($step); - $oPluginRegistry->registerFolder('pmosCommunity', '1234', 'config'); - $step = $oPluginRegistry->isRegisteredFolder('config'); - $this->assertEquals('pmosCommunity', $step); - $step = $oPluginRegistry->isRegisteredFolder('noExist'); - $this->assertFalse($step); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::getMenus - */ - public function testGetMenusParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('getMenus', $methods), 'exists method getMenus'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'getMenus'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'menuId'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * Test get menus - */ - public function testGetMenus() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin('enterprise'); - $oPluginRegistry->registerMenu( - 'charts', - 'processmaker', - PATH_PLUGINS . 'charts.php' - ); - $oPluginRegistry->getMenus('processmaker'); - $this->assertTrue(file_exists($oPluginRegistry->_aMenus[0]->sFilename)); - } - - /** - * Test get dashlets - */ - public function testGetDashlets() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin('enterprise'); - $this->assertTrue(is_array($oPluginRegistry->getDashlets())); - } - - /** - * Test get reports - */ - public function testGetReports() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin('enterprise'); - $this->assertTrue(is_array($oPluginRegistry->getReports())); - } - - /** - * Test get pmfunction - */ - public function testGetPmFunctions() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin('enterprise'); - $this->assertTrue(is_array($oPluginRegistry->getPmFunctions())); - } - - /** - * Test get steps - */ - public function testGetSteps() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin('enterprise'); - $this->assertTrue(is_array($oPluginRegistry->getSteps())); - } - - /** - * Test get redirect login - */ - public function testGetRedirectLogins() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin('enterprise'); - $this->assertTrue(is_array($oPluginRegistry->getRedirectLogins())); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerTrigger - */ - public function testRegisterTriggerParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerTrigger', $methods), 'exists method registerTrigger'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerTrigger'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sTriggerId'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'sTriggerName'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - } - - public function testRegisterTrigger() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerTrigger('enterprise', 'test1234', 'TestTrigger'); - $this->assertEquals( - 'TestTrigger', - $oPluginRegistry->_aTriggers[0]->sTriggerName, - 'sTriggerName attribute does not equals' - ); - $this->assertObjectHasAttribute( - 'sTriggerId', - $oPluginRegistry->_aTriggers[0], - 'sTriggerId attribute does not exist' - ); - $this->assertInstanceOf(TriggerDetail::class, $oPluginRegistry->_aTriggers[0], ''); - $oPluginRegistry->registerTrigger('enterprise', 'test1234', 'TestTrigger'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::getTriggerInfo - */ - public function testGetTriggerInfoParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('getTriggerInfo', $methods), 'exists method getTriggerInfo'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'getTriggerInfo'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'triggerId'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - public function testGetTriggerInfo() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin('charts'); - $oPluginRegistry->registerFolder('charts', '1234', 'charts'); - $oPluginRegistry->registerTrigger('charts', 'trigger1234', 'TestTrigger'); - $trigger = $oPluginRegistry->getTriggerInfo('trigger1234'); - $this->assertEquals( - 'TestTrigger', - $trigger->sTriggerName, - 'sTriggerName attribute does not equals' - ); - $this->assertObjectHasAttribute( - 'sTriggerId', - $trigger, - 'sTriggerId attribute does not exist' - ); - $this->assertInstanceOf(TriggerDetail::class, $trigger, ''); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::existsTrigger - */ - public function testExistsTriggerParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('existsTrigger', $methods), 'exists method existsTrigger'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'existsTrigger'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'triggerId'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - public function testExistsTrigger() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->registerFolder('enterprise', '1234', 'charts'); - $oPluginRegistry->registerTrigger('enterprise', 'trigger1234', 'TestTrigger'); - $trigger = $oPluginRegistry->existsTrigger('trigger1234'); - $this->assertTrue($trigger, 'sTriggerName attribute does not equals'); - $trigger = $oPluginRegistry->existsTrigger('NoExist'); - $this->assertFalse($trigger, 'sTriggerId attribute does not exist'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::executeTriggers - */ - public function testExecuteTriggersParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('executeTriggers', $methods), 'exists method executeTriggers'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'executeTriggers'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'triggerId'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'oData'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - } - - public function testExecuteTriggers() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $pluginFile = 'pmosCommunity.php'; - //add the plugin php file - require_once(PATH_PLUGINS . "pmosCommunity.php"); - //register mulitenant in the plugin registry singleton, because details are read from this instance - $oPluginRegistry->registerPlugin("pmosCommunity", $pluginFile); - $oPluginRegistry->registerFolder('pmosCommunity', 'Folder1234', 'pmosCommunity'); - $oPluginRegistry->registerTrigger('pmosCommunity', 'Trigger1234', 'getAvailableCharts'); - $trigger = $oPluginRegistry->executeTriggers('Trigger1234', []); - $this->assertTrue(is_array($trigger), ' attribute does not equals'); - $this->assertContains('ForumWeek', $trigger, 'ForumWeek element does not exist'); - $oPluginRegistry->registerTrigger('enterprise1', 'Trigger4321', 'notExist'); - $trigger = $oPluginRegistry->executeTriggers('Trigger4321', []); - $this->assertNull($trigger, 'sTriggerId attribute does not exist'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::getPlugin - */ - public function testGetPluginParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('getPlugin', $methods), 'exists method getPlugin'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'getPlugin'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - public function testGetPlugin() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $plugin = $oPluginRegistry->getPlugin('enterprise'); - $this->assertEquals( - 'enterprise', - $plugin->sPluginFolder, - 'sPluginFolder attribute does not equals' - ); - $this->assertObjectHasAttribute('sNamespace', $plugin, 'sNamespace attribute does not exist'); - $this->assertInstanceOf(\enterprisePlugin::class, $plugin, ''); - $plugin = $oPluginRegistry->getPlugin('namespaceNoExist'); - $this->assertNull($plugin); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::setCompanyLogo - */ - public function testSetCompanyLogoParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('setCompanyLogo', $methods), 'exists method setCompanyLogo'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'setCompanyLogo'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'filename'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - } - - public function testSetCompanyLogo() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->setCompanyLogo('enterprise', PATH_PLUGINS . 'testLogo.png'); - $this->assertEquals( - PATH_PLUGINS . 'testLogo.png', - $oPluginRegistry->_aPluginDetails['enterprise']->sCompanyLogo, - 'sPluginFolder attribute does not equals' - ); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::getCompanyLogo - */ - public function testGetCompanyLogoParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('getCompanyLogo', $methods), 'exists method getCompanyLogo'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'getCompanyLogo'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'default'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - public function testGetCompanyLogo() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $oPluginRegistry->setCompanyLogo('enterprise', PATH_PLUGINS . 'Logo.png'); - $logo = $oPluginRegistry->getCompanyLogo(PATH_PLUGINS . 'testLogo.png'); - $this->assertEquals( - PATH_PLUGINS . 'Logo.png', - $logo, - 'sPluginFolder attribute does not equals' - ); - } - - public function testGetCompanyLogoDefault() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $oPluginRegistry->enablePlugin("enterprise"); - $logo = $oPluginRegistry->getCompanyLogo(PATH_PLUGINS . 'Logo.png'); - $this->assertEquals( - PATH_PLUGINS . 'Logo.png', - $logo, - 'sPluginFolder attribute does not equals' - ); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::executeMethod - */ - public function testExecuteMethodParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('executeMethod', $methods), 'exists method executeMethod'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'executeMethod'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'methodName'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'oData'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - } - - public function testExecuteMethod() - { - $oPluginRegistry = PluginsRegistry::loadSingleton(); - $pluginFile = 'pmosCommunity.php'; - //add the plugin php file - require_once(PATH_PLUGINS . "pmosCommunity.php"); - //register mulitenant in the plugin registry singleton, because details are read from this instance - $oPluginRegistry->registerPlugin("pmosCommunity", $pluginFile); - $oPluginRegistry->registerFolder('pmosCommunity', 'Folder1234', 'pmosCommunity'); - $oPluginRegistry->registerTrigger('pmosCommunity', 'Trigger1234', 'getAvailableCharts'); - $trigger = $oPluginRegistry->executeMethod('Trigger1234', []); - $this->assertTrue(is_array($trigger), ' attribute does not equals'); - $this->assertContains('ForumWeek', $trigger, 'ForumWeek element does not exist'); - $oPluginRegistry->registerTrigger('enterprise1', 'Trigger4321', 'notExist'); - $trigger = $oPluginRegistry->executeMethod('Trigger4321', []); - $this->assertNull($trigger, 'sTriggerId attribute does not exist'); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::getFieldsForPageSetup - */ - public function testGetFieldsForPageSetupParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('getFieldsForPageSetup', $methods), 'exists method getFieldsForPageSetup'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'getFieldsForPageSetup'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::updateFieldsForPageSetup - */ - public function testUpdateFieldsForPageSetupParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('updateFieldsForPageSetup', $methods), 'exists method updateFieldsForPageSetup'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'updateFieldsForPageSetup'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'oData'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerToolbarFile - */ - public function testRegisterToolbarFileParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerToolbarFile', $methods), 'exists method registerToolbarFile'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerToolbarFile'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sToolbarId'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'sFilename'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::getToolbarOptions - */ - public function testGetToolbarOptionsParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('getToolbarOptions', $methods), 'exists method getToolbarOptions'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'getToolbarOptions'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sToolbarId'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerCaseSchedulerPlugin - */ - public function testRegisterCaseSchedulerPluginParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue( - in_array('registerCaseSchedulerPlugin', $methods), - 'exists method registerCaseSchedulerPlugin' - ); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerCaseSchedulerPlugin'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sActionId'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'sActionForm'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - $this->assertTrue($params[3]->getName() == 'sActionSave'); - $this->assertTrue($params[3]->isArray() == false); - $this->assertTrue($params[3]->isOptional() == false); - $this->assertTrue($params[4]->getName() == 'sActionExecute'); - $this->assertTrue($params[4]->isArray() == false); - $this->assertTrue($params[4]->isOptional() == false); - $this->assertTrue($params[5]->getName() == 'sActionGetFields'); - $this->assertTrue($params[5]->isArray() == false); - $this->assertTrue($params[5]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerTaskExtendedProperty - */ - public function testRegisterTaskExtendedPropertyParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue( - in_array('registerTaskExtendedProperty', $methods), - 'exists method registerTaskExtendedProperty' - ); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerTaskExtendedProperty'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sPage'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'sName'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - $this->assertTrue($params[3]->getName() == 'sIcon'); - $this->assertTrue($params[3]->isArray() == false); - $this->assertTrue($params[3]->isOptional() == false); - } - - /** - * @covers \ProcessMaker\Plugins\PluginsRegistry::registerDashboardPage - */ - public function testRegisterDashboardPageParams() - { - $methods = get_class_methods($this->oPluginRegistry); - $this->assertTrue(in_array('registerDashboardPage', $methods), 'exists method registerDashboardPage'); - $r = new \ReflectionMethod('\ProcessMaker\Plugins\PluginsRegistry', 'registerDashboardPage'); - $params = $r->getParameters(); - $this->assertTrue($params[0]->getName() == 'sNamespace'); - $this->assertTrue($params[0]->isArray() == false); - $this->assertTrue($params[0]->isOptional() == false); - $this->assertTrue($params[1]->getName() == 'sPage'); - $this->assertTrue($params[1]->isArray() == false); - $this->assertTrue($params[1]->isOptional() == false); - $this->assertTrue($params[2]->getName() == 'sName'); - $this->assertTrue($params[2]->isArray() == false); - $this->assertTrue($params[2]->isOptional() == false); - $this->assertTrue($params[3]->getName() == 'sIcon'); - $this->assertTrue($params[3]->isArray() == false); - $this->assertTrue($params[3]->isOptional() == false); - } -} diff --git a/workflow/engine/bin/tasks/cliFlushCache.php b/workflow/engine/bin/tasks/cliFlushCache.php index 6a4a8f28a..2be46226e 100644 --- a/workflow/engine/bin/tasks/cliFlushCache.php +++ b/workflow/engine/bin/tasks/cliFlushCache.php @@ -25,6 +25,8 @@ */ +use ProcessMaker\Util\System; + CLI::taskName('flush-cache'); CLI::taskDescription(<<name . " ... "; echo PHP_EOL; echo " Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... " . PHP_EOL; - \ProcessMaker\Util\System::flushCache($workspace); + System::flushCache($workspace); echo "DONE" . PHP_EOL; } catch (Exception $e) { echo $e->getMessage() . PHP_EOL; diff --git a/workflow/engine/classes/class.Installer.php b/workflow/engine/classes/class.Installer.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/workflow/engine/classes/class.processMap.php b/workflow/engine/classes/class.processMap.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/workflow/engine/methods/enterprise/addonsStoreAction.php b/workflow/engine/methods/enterprise/addonsStoreAction.php index d07bd1a7f..a42344f79 100644 --- a/workflow/engine/methods/enterprise/addonsStoreAction.php +++ b/workflow/engine/methods/enterprise/addonsStoreAction.php @@ -4,6 +4,8 @@ require_once PATH_CORE . 'classes' . PATH_SEP . 'class.pmLicenseManager.php'; require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php'; require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AddonsManagerPeer.php'; +use ProcessMaker\Plugins\PluginRegistry; + function runBgProcessmaker($task, $log) { require_once (PATH_CORE . "bin/tasks/cliAddons.php"); @@ -80,7 +82,7 @@ try { BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn); //are all the plugins that are enabled in the workspace - $pluginRegistry = ProcessMaker\Plugins\PluginRegistry::loadSingleton(); + $pluginRegistry = PluginRegistry::loadSingleton(); /** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */ foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) { if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) { diff --git a/workflow/engine/methods/enterprise/pluginsSetup.php b/workflow/engine/methods/enterprise/pluginsSetup.php index d4fcad8d8..59e700ac1 100644 --- a/workflow/engine/methods/enterprise/pluginsSetup.php +++ b/workflow/engine/methods/enterprise/pluginsSetup.php @@ -1,8 +1,10 @@ getPluginDetails( $pluginFile ); $folder = $details->getFolder(); diff --git a/workflow/engine/methods/install/autoinstallPlugins.php b/workflow/engine/methods/install/autoinstallPlugins.php index 02530513b..02df8f7a8 100644 --- a/workflow/engine/methods/install/autoinstallPlugins.php +++ b/workflow/engine/methods/install/autoinstallPlugins.php @@ -21,6 +21,9 @@ * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ + +use ProcessMaker\Plugins\PluginRegistry; + $inst = new PmInstaller(); $oProcess = new Processes(); @@ -57,7 +60,7 @@ foreach ($availablePlugins as $filename) { } //print "change to ENABLED"; - $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton(); + $oPluginRegistry = PluginRegistry::loadSingleton(); $pluginFile = $sClassName . '.php'; if (! file_exists( PATH_PLUGINS . $sClassName . '.php' )) { diff --git a/workflow/engine/methods/login/changePassword.php b/workflow/engine/methods/login/changePassword.php index 1fd8f1ae7..a17e2739d 100644 --- a/workflow/engine/methods/login/changePassword.php +++ b/workflow/engine/methods/login/changePassword.php @@ -1,4 +1,7 @@ load($_SESSION['USER_LOGGED']); @@ -50,7 +53,7 @@ if (class_exists('redirectDetail')) { if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) { $userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']; } - $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton(); + $oPluginRegistry = PluginRegistry::loadSingleton(); //$oPluginRegistry->showArrays(); $aRedirectLogin = $oPluginRegistry->getRedirectLogins(); if (isset($aRedirectLogin)) { diff --git a/workflow/engine/methods/login/licenseUpdate.php b/workflow/engine/methods/login/licenseUpdate.php index 38bbfbe36..26e4dcdab 100644 --- a/workflow/engine/methods/login/licenseUpdate.php +++ b/workflow/engine/methods/login/licenseUpdate.php @@ -1,5 +1,7 @@ getAllPluginsDetails() as $plugin) { if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) { diff --git a/workflow/engine/src/ProcessMaker/Plugins/Adapters/PluginAdapter.php b/workflow/engine/src/ProcessMaker/Plugins/Adapters/PluginAdapter.php index 6f12181f1..97118e7c0 100644 --- a/workflow/engine/src/ProcessMaker/Plugins/Adapters/PluginAdapter.php +++ b/workflow/engine/src/ProcessMaker/Plugins/Adapters/PluginAdapter.php @@ -2,6 +2,8 @@ namespace ProcessMaker\Plugins\Adapters; +use G; +use PluginsRegistry; use PMPluginRegistry; /** @@ -111,7 +113,7 @@ class PluginAdapter */ public function migrate($PMPluginsSingleton) { - $this->PMPluginRegistry = \G::json_decode(\G::json_encode($PMPluginsSingleton->getAttributes()), true); + $this->PMPluginRegistry = G::json_decode(G::json_encode($PMPluginsSingleton->getAttributes()), true); $this->parserNameKey(); foreach ($this->PMPluginRegistry['_aPluginDetails'] as $nameSpace => $value) { $this->saveInTable($nameSpace, $this->PMPluginRegistry); @@ -157,8 +159,8 @@ class PluginAdapter $newStructurePlugin = $this->getAllAttributes($Namespace, $PMPluginRegistry); $plugin = $this->convertFieldTable($newStructurePlugin); if ($plugin['PLUGIN_NAMESPACE'] && $plugin['PLUGIN_CLASS_NAME'] && $plugin['PLUGIN_FILE']) { - $fieldPlugin = \PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin); - \PluginsRegistry::update($fieldPlugin); + $fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin); + PluginsRegistry::update($fieldPlugin); } } @@ -215,7 +217,7 @@ class PluginAdapter $valueField = (array_key_exists($name, $fieldsInTable) && $fieldsInTable[$name]) ? $fieldsInTable[$name] : []; - $valueField = \G::json_encode($valueField); + $valueField = G::json_encode($valueField); break; case 'int': $valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : 0; @@ -233,7 +235,7 @@ class PluginAdapter } $fields[$property['name']] = $valueField; } - $fields['PLUGIN_ATTRIBUTES'] = \G::json_encode($extraAttributes); + $fields['PLUGIN_ATTRIBUTES'] = G::json_encode($extraAttributes); return $fields; } } diff --git a/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php index cce3f2cd7..cf052bccc 100644 --- a/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php +++ b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php @@ -2,8 +2,15 @@ namespace ProcessMaker\Plugins; +use Archive_Tar; use enterprisePlugin; use Exception; +use G; +use InputFilter; +use Language; +use PEAR; +use PluginsRegistry; +use PmSystem; use ProcessMaker\Plugins\Adapters\PluginAdapter; use ProcessMaker\Plugins\Interfaces\CaseSchedulerPlugin; use ProcessMaker\Plugins\Interfaces\CronFile; @@ -24,6 +31,9 @@ use ProcessMaker\Plugins\Interfaces\ToolbarDetail; use ProcessMaker\Plugins\Interfaces\TriggerDetail; use ProcessMaker\Plugins\Traits\Attributes; use ProcessMaker\Plugins\Traits\PluginStructure; +use Publisher; +use stdClass; +use System; /** * Class PluginRegistry @@ -151,9 +161,9 @@ class PluginRegistry } catch (Exception $e) { global $G_PUBLISH; $Message['MESSAGE'] = $e->getMessage(); - $G_PUBLISH = new \Publisher(); + $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $Message); - \G::RenderPage('publish'); + G::RenderPage('publish'); die(); } } @@ -167,8 +177,8 @@ class PluginRegistry $newStructurePlugin = $this->getAllAttributes($Namespace); $plugin = $this->convertFieldTable($newStructurePlugin); if ($plugin['PLUGIN_NAMESPACE'] && $plugin['PLUGIN_CLASS_NAME'] && $plugin['PLUGIN_FILE']) { - $fieldPlugin = \PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin); - \PluginsRegistry::update($fieldPlugin); + $fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin); + PluginsRegistry::update($fieldPlugin); } } /** @@ -323,8 +333,7 @@ class PluginRegistry */ public function installPluginArchive($Filename, $Namespace) { - \G::LoadThirdParty("pear/Archive", "Tar"); - $tar = new \Archive_Tar($Filename); + $tar = new Archive_Tar($Filename); $files = $tar->listContent(); $plugins = array(); $namePlugin = array(); @@ -375,7 +384,7 @@ class PluginRegistry } $path = PATH_PLUGINS . $pluginFile; - $filter = new \InputFilter(); + $filter = new InputFilter(); $path = $filter->validateInput($path, 'path'); require_once($path); @@ -402,7 +411,7 @@ class PluginRegistry } if (isset($detail->sPluginFolder) && !empty($detail->sPluginFolder) && file_exists($pluginDir)) { - \G::rm_dir($pluginDir); + G::rm_dir($pluginDir); } /////// @@ -419,7 +428,7 @@ class PluginRegistry */ public function uninstallPluginWorkspaces($arrayPlugin) { - $workspace = \System::listWorkspaces(); + $workspace = PmSystem::listWorkspaces(); foreach ($workspace as $indexWS => $ws) { $pluginRegistry = PluginRegistry::loadSingleton(); @@ -456,9 +465,9 @@ class PluginRegistry } catch (Exception $e) { global $G_PUBLISH; $Message['MESSAGE'] = $e->getMessage(); - $G_PUBLISH = new \Publisher(); + $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $Message); - \G::RenderPage('publish'); + G::RenderPage('publish'); die(); } } @@ -805,7 +814,6 @@ class PluginRegistry */ public function executeTriggers($TriggerId, $oData) { - \G::LoadThirdParty("pear", "PEAR"); /** @var TriggerDetail $trigger */ foreach ($this->_aTriggers as $trigger) { if ($trigger->equalTriggerId($TriggerId)) { @@ -833,7 +841,7 @@ class PluginRegistry $obj = new $sClassName(); $methodName = $trigger->getTriggerName(); $response = $obj->{$methodName}($oData); - if (\PEAR::isError($response)) { + if (PEAR::isError($response)) { print $response->getMessage(); return; } @@ -1304,7 +1312,7 @@ class PluginRegistry */ public function verifyTranslation($Namespace) { - $language = new \Language(); + $language = new Language(); $pathPluginTranslations = PATH_PLUGINS . $Namespace . PATH_SEP . 'translations' . PATH_SEP; if (file_exists($pathPluginTranslations . 'translations.php')) { if (!file_exists($pathPluginTranslations . $Namespace . '.' . SYS_LANG . '.po')) { @@ -1362,7 +1370,7 @@ class PluginRegistry public function updatePluginAttributesInAllWorkspaces($Namespace) { try { - \G::LoadClass("wsTools"); + G::LoadClass("wsTools"); //Set variables $pluginFileName = $Namespace . ".php"; @@ -1384,7 +1392,7 @@ class PluginRegistry ) { $arrayWorkspace = array(); - foreach (\System::listWorkspaces() as $value) { + foreach (PmSystem::listWorkspaces() as $value) { $workspaceTools = $value; $arrayWorkspace[] = $workspaceTools->name; @@ -1459,7 +1467,7 @@ class PluginRegistry } if (!$flagFound) { - $obj = new \stdClass(); + $obj = new stdClass(); $obj->pluginName = $pluginName; $obj->file = $file; @@ -1606,7 +1614,7 @@ class PluginRegistry */ public function getPluginByCode($code) { - $plugin = new \stdClass(); + $plugin = new stdClass(); foreach ($this->_aPlugins as $plugin) { $plugin = (array)$plugin; if (strtoupper($plugin['sNamespace']) == $code) { @@ -1655,7 +1663,7 @@ class PluginRegistry } if (!$flagFound) { - $obj = new \stdClass(); + $obj = new stdClass(); $obj->pluginName = $pluginName; $obj->pathFile = $pathFile; diff --git a/workflow/engine/src/ProcessMaker/Plugins/Traits/PluginStructure.php b/workflow/engine/src/ProcessMaker/Plugins/Traits/PluginStructure.php index 858db8e07..bfd03254c 100644 --- a/workflow/engine/src/ProcessMaker/Plugins/Traits/PluginStructure.php +++ b/workflow/engine/src/ProcessMaker/Plugins/Traits/PluginStructure.php @@ -3,6 +3,7 @@ namespace ProcessMaker\Plugins\Traits; use BasePeer; +use G; use PluginsRegistry; use ProcessMaker\Plugins\Interfaces\CssFile; use ProcessMaker\Plugins\Interfaces\FolderDetail; @@ -106,16 +107,16 @@ trait PluginStructure foreach ($Plugins as $plugin) { $this->_aPluginDetails[$plugin['PluginNamespace']] = $this->buildPluginDetails($plugin); if ($plugin['PluginEnable']) { - $this->buildMenus(\G::json_decode($plugin['PluginMenus'], true)); - $this->buildFolders(\G::json_decode($plugin['PluginFolders'], true)); - $this->buildTriggers(\G::json_decode($plugin['PluginTriggers'], true)); - $this->buildPmFunctions(\G::json_decode($plugin['PluginPmFunctions'], true)); - $this->buildRedirectLogin(\G::json_decode($plugin['PluginRedirectLogin'], true)); - $this->buildSteps(\G::json_decode($plugin['PluginSteps'], true)); - $this->buildCss(\G::json_decode($plugin['PluginCss'], true)); - $this->buildJs(\G::json_decode($plugin['PluginJs'], true)); - $this->buildRestService(\G::json_decode($plugin['PluginRestService'], true)); - $this->buildAttributes($plugin['PluginNamespace'], \G::json_decode($plugin['PluginAttributes'])); + $this->buildMenus(G::json_decode($plugin['PluginMenus'], true)); + $this->buildFolders(G::json_decode($plugin['PluginFolders'], true)); + $this->buildTriggers(G::json_decode($plugin['PluginTriggers'], true)); + $this->buildPmFunctions(G::json_decode($plugin['PluginPmFunctions'], true)); + $this->buildRedirectLogin(G::json_decode($plugin['PluginRedirectLogin'], true)); + $this->buildSteps(G::json_decode($plugin['PluginSteps'], true)); + $this->buildCss(G::json_decode($plugin['PluginCss'], true)); + $this->buildJs(G::json_decode($plugin['PluginJs'], true)); + $this->buildRestService(G::json_decode($plugin['PluginRestService'], true)); + $this->buildAttributes($plugin['PluginNamespace'], G::json_decode($plugin['PluginAttributes'])); } } } @@ -137,7 +138,7 @@ trait PluginStructure $plugin['PluginSetupPage'], $plugin['PluginVersion'], $plugin['PluginCompanyLogo'], - \G::json_decode($plugin['PluginWorkspaces']), + G::json_decode($plugin['PluginWorkspaces']), $plugin['PluginEnable'], $plugin['PluginPrivate'] ); @@ -288,7 +289,7 @@ trait PluginStructure $PluginDetails = $PluginRegistry->_aPluginDetails[$Namespace]; unset($PluginRegistry->_aPluginDetails); $Plugin = isset($PluginRegistry->_aPlugins[$Namespace]) ? - \G::json_decode(\G::json_encode($PluginRegistry->_aPlugins[$Namespace]), true) : + G::json_decode(G::json_encode($PluginRegistry->_aPlugins[$Namespace]), true) : []; unset($PluginRegistry->_aPlugins); $newStructurePlugin = array_merge($Plugin, $PluginDetails->getAttributes()); @@ -339,7 +340,7 @@ trait PluginStructure } } } - $valueField = \G::json_encode($valueField); + $valueField = G::json_encode($valueField); break; case 'int': $valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : 0; @@ -357,7 +358,7 @@ trait PluginStructure } $fields[$property['name']] = $valueField; } - $fields['PLUGIN_ATTRIBUTES'] = \G::json_encode($extraAttributes); + $fields['PLUGIN_ATTRIBUTES'] = G::json_encode($extraAttributes); return $fields; } }