function test_runScript() { $GLOBALS['_MAX']['CONF']['table']['prefix'] = $this->prefix; $oUpgrade = new OA_Upgrade(); $oUpgrade->initDatabaseConnection(); $oDbh =& $oUpgrade->oDbh; $oTable = new OA_DB_Table(); $testfile = MAX_PATH . "/etc/changes/tests/data/schema_tables_core_dashboard.xml"; $oTable->init($testfile); $table = 'preference'; $aExistingTables = OA_DB_Table::listOATablesCaseSensitive(); if (in_array($this->prefix . $table, $aExistingTables)) { $this->assertTrue($oTable->dropTable($this->prefix . $table), 'error dropping ' . $this->prefix . $table); } $this->assertTrue($oTable->createTable($table), 'error creating ' . $this->prefix . $table); $aExistingTables = OA_DB_Table::listOATablesCaseSensitive(); $this->assertTrue(in_array($this->prefix . $table, $aExistingTables), $this->prefix . $table . ' table not found'); $this->assertTrue($oUpgrade->runScript('postscript_openads_upgrade_2.3.36-beta-rc1.php')); $aExistingColumns = $oDbh->manager->listTableFields($this->prefix . $table); $aColumns = array('ad_clicks_sum', 'ad_views_sum', 'ad_clicks_per_second', 'ad_views_per_second', 'ad_cs_data_last_sent', 'ad_cs_data_last_sent', 'ad_cs_data_last_received'); foreach ($aColumns as $column) { $this->assertFalse(in_array($column, $aExistingColumns, $column . ' found in column list')); } TestEnv::restoreConfig(); TestEnv::restoreEnv(); }
function test_runScript() { $aExpectation = $this->_generateTestData(); $oUpgrade = new OA_Upgrade(); $oUpgrade->initDatabaseConnection(); $this->assertTrue($oUpgrade->runScript('postscript_openads_upgrade_2.7.11-dev.php')); $this->_assertTestData($aExpectation); DataGenerator::cleanUp(); }
function test_runScript() { $oUpgrade = new OA_Upgrade(); $this->oConfiguration = $oUpgrade->oConfiguration; $oUpgrade->initDatabaseConnection(); $oDbh =& $oUpgrade->oDbh; $oTable = new OA_DB_Table(); $table = 'database_action'; $testfile = MAX_PATH . "/lib/OA/Upgrade/tests/data/{$table}.xml"; $oTable->init($testfile); $this->assertTrue($oTable->dropTable($this->prefix . $table), 'error dropping ' . $this->prefix . $table); $this->assertTrue($oTable->createTable($table), 'error creating ' . $this->prefix . $table); $aExistingTables = OA_DB_Table::listOATablesCaseSensitive(); $this->assertTrue(in_array($this->prefix . $table, $aExistingTables), 'old database_action table not found'); $this->assertTrue($oUpgrade->runScript('prescript_openads_upgrade_2.3.33-beta-rc4.php')); TestEnv::restoreConfig(); }
function test_runScript() { $oUpgrade = new OA_Upgrade(); $oUpgrade->upgradePath = MAX_PATH . '/lib/OA/Upgrade/tests/data/'; $this->assertTrue($oUpgrade->runScript('prescript_openads_upgrade_1_to_2.php')); }