function upgradeToVersion($version) { Mock::generatePartial('OA_UpgradeLogger', $mockLogger = 'OA_UpgradeLogger' . rand(), array('logOnly', 'logError', 'log')); $oLogger = new $mockLogger($this); $oLogger->setReturnValue('logOnly', true); $oLogger->setReturnValue('logError', true); $oLogger->setReturnValue('log', true); $this->oDBUpgrader = new OA_DB_Upgrade($oLogger); $this->oDBUpgrader->logFile = MAX_PATH . '/var/DB_Upgrade.test.log'; $this->oDBUpgrader->initMDB2Schema(); $auditor = new OA_DB_UpgradeAuditor(); $this->oDBUpgrader->oAuditor =& $auditor; $this->assertTrue($auditor->init($this->oDBUpgrader->oSchema->db), 'error initialising upgrade auditor, probable error creating database action table'); // execute all database upgrade actions for a given schema version // constructive first $this->oDBUpgrader->init('constructive', 'tables_core', $version); $this->oDBUpgrader->doBackups = false; $this->assertTrue($this->oDBUpgrader->upgrade(), 'constructive'); // use same changeset, switch timing only to execute destructive $this->oDBUpgrader->init('destructive', 'tables_core', $version, true); $this->assertTrue($this->oDBUpgrader->upgrade(), 'destructive'); }