function test_checkSchemaIntegrity()
 {
     $this->path = MAX_PATH . '/lib/OA/Upgrade/tests/data/';
     $oDB_Upgrade = $this->_newDBUpgradeObject();
     $oTable = new OA_DB_Table();
     $oTable->init(MAX_PATH . '/etc/tables_core.xml');
     $oTable->dropAllTables();
     $prefixOld = $this->prefix;
     $GLOBALS['_MAX']['CONF']['table']['prefix'] = 'oA_';
     $oDB_Upgrade->prefix = 'oA_';
     $this->prefix = 'oA_';
     // new tables table1 and table2
     $this->_createTestTables($oDB_Upgrade->oSchema->db);
     // get the current definition
     $oTable->init($this->path . 'schema_test_tables_core2.xml');
     $oDB_Upgrade->aDefinitionNew = $oTable->aDefinition;
     //$oTable->dropAllTables();
     // get a changed definition and implement it
     $oTable->init($this->path . 'schema_test_tables_core1.xml');
     $oTable->createAllTables();
     // now the following have changed
     // to *imitate* a broken/tweaked database
     // missing password_recovery table
     // new column preference.user_custom_field1
     // missing column preference.updates_enabled
     // changed column zones.cost from dec 10,4 to dec 12,2
     $this->assertTrue($oDB_Upgrade->checkSchemaIntegrity(MAX_PATH . '/var/changes_tables_core2'), '');
     $aConstructive = $oDB_Upgrade->aChanges['constructive']['tables'];
     $aDestructive = $oDB_Upgrade->aChanges['destructive']['tables'];
     $this->assertTrue(isset($aConstructive['add']), 'array of add tables not found');
     $this->assertTrue(isset($aConstructive['add']['password_recovery']), 'password_recovery not found in array of add tables');
     $this->assertTrue(isset($aConstructive['change']), 'change tables not found');
     $this->assertTrue(isset($aConstructive['change']['zones']), 'zones table not found in change array');
     $this->assertTrue(isset($aConstructive['change']['zones']['change']['fields']['cost']['length']), 'zones field changes not found in change array');
     $this->assertTrue(isset($aConstructive['change']['preference']), 'preference table not found in change array');
     $this->assertTrue(isset($aConstructive['change']['preference']['add']['fields']['updates_enabled']), 'preference field changes not found in change array');
     $this->assertTrue(isset($aDestructive['remove']), 'remove tables not found');
     $this->assertTrue(isset($aDestructive['remove']['table1']), 'table1 not found in remove tables array');
     $this->assertTrue(isset($aDestructive['remove']['table2']), 'table2 not found in remove tables array');
     $this->assertTrue(isset($aDestructive['change']), 'change tables not found');
     $this->assertTrue(isset($aDestructive['change']['preference']), 'preference table not found in change array');
     $this->assertTrue(isset($aDestructive['change']['preference']['remove']['user_custom_field1']), 'preference field changes not found in change array');
     if (file_exists(MAX_PATH . '/var/changes_tables_core2')) {
         unlink(MAX_PATH . '/var/changes_tables_core2');
     }
     $oTable->dropAllTables();
     $this->prefix = $prefixOld;
     TestEnv::restoreConfig();
     TestEnv::restoreEnv();
 }