function test_cacheDataObjects() { $oPluginManager = new OX_Plugin_ComponentGroupManager(); $oPluginManager->pathPackages = $this->testpathPackages; $pathPlugin = MAX_PATH . $this->testpathPackages . 'testPlugin/etc/DataObjects/'; $aSchemaPlugin = @parse_ini_file($pathPlugin . 'db_schema.ini', true); $aLinksPlugin = @parse_ini_file($pathPlugin . 'db_schema.links.ini', true); $outputDir = MAX_PATH . '/var/'; // Test 1 - re-create cache $aConf = array('testPlugin' => 1, 'testDepends' => 0); $GLOBALS['_MAX']['CONF']['pluginGroupComponents'] = $aConf; $aResult = $oPluginManager->_cacheDataObjects(null, null, $outputDir); $aSchemas = $aResult['schemas']->toArray(); $aLinks = $aResult['links']->toArray(); $this->assertEqual(count($aSchemaPlugin), count($aSchemas['root'])); $this->assertEqual(count($aLinksPlugin), count($aLinks['root'])); $this->assertTrue(file_exists($outputDir . 'db_schema.ini')); $this->assertTrue(file_exists($outputDir . 'db_schema.links.ini')); @unlink($outputDir . 'db_schema.ini'); @unlink($outputDir . 'db_schema.links.ini'); $GLOBALS['_MAX']['CONF']['pluginGroupComponents'] = array(); // Test 2 - re-create cache with a new plugin, schema not provided $aResult = $oPluginManager->_cacheDataObjects('testPlugin', null, $outputDir); $aSchemas = $aResult['schemas']->toArray(); $aLinks = $aResult['links']->toArray(); $this->assertEqual(count($aSchemaPlugin), count($aSchemas['root'])); $this->assertEqual(count($aLinksPlugin), count($aLinks['root'])); $this->assertTrue(file_exists($outputDir . 'db_schema.ini')); $this->assertTrue(file_exists($outputDir . 'db_schema.links.ini')); @unlink($outputDir . 'db_schema.ini'); @unlink($outputDir . 'db_schema.links.ini'); // Test 2 - re-create cache with a new plugin, schema provided $aSchema = array('mdb2schema' => 'tables_testPlugin', 'dboschema' => 'db_schema', 'dbolinks' => 'db_schema.links', 'dataobjects' => array(0 => 'Testplugin_table.php')); $aResult = $oPluginManager->_cacheDataObjects('testPlugin', $aSchema, $outputDir); $aSchemas = $aResult['schemas']->toArray(); $aLinks = $aResult['links']->toArray(); $this->assertEqual(count($aSchemaPlugin), count($aSchemas['root'])); $this->assertEqual(count($aLinksPlugin), count($aLinks['root'])); $this->assertTrue(file_exists($outputDir . 'db_schema.ini')); $this->assertTrue(file_exists($outputDir . 'db_schema.links.ini')); @unlink($outputDir . 'db_schema.ini'); @unlink($outputDir . 'db_schema.links.ini'); }