예제 #1
0
 /**
  * initialisation
  *
  * load the 'requestset' config file
  * do not load the dataset yet - allow child scenario to choose
  *
  * @param string $filename - name of scenario's dataset and config
  * @param string $dbname database name
  */
 function init($filename)
 {
     $GLOBALS['_MAX']['CONF']['table']['prefix'] = '';
     // assign the inputs
     $this->requestFile = SCENARIOS_REQUESTSETS . $filename . '.php';
     // load the request data
     $this->loadRequestset();
     // tweak some conf vals
     $GLOBALS['_MAX']['COOKIE']['newViewerId'] = '';
     $_COOKIE = $HTTP_COOKIE_VARS = array();
     // get service locator instance
     $this->oServiceLocator =& OA_ServiceLocator::instance();
     // start with a clean set of tables
     OA_DB_Table_Core::destroy();
     $this->oCoreTables =& OA_DB_Table_Core::singleton();
     // get the database handler
     $this->oDbh =& OA_DB::singleton();
     // fake the date/time
     $this->setDateTime();
 }
예제 #2
0
 /**
  * A method for re-parsing the testing environment configuration
  * file, to restore it in the event it needed to be changed
  * during a test.
  *
  * @todo Remove the audit hack
  */
 static function restoreConfig()
 {
     // Destroy cached table classes
     OA_DB_Table_Core::destroy();
     // Restore and Re-parse the config file
     $backupConfigFilename = $GLOBALS['_MAX']['TEST']['backupConfigFilename'];
     if (!empty($backupConfigFilename) && is_readable($backupConfigFilename)) {
         $configFile = TestEnv::getConfigFilename();
         copy($backupConfigFilename, $configFile);
     } else {
         OA::debug("Could not restore config file from backup: {$backupConfigFilename}");
     }
     $newConf = TestEnv::parseConfigFile();
     foreach ($newConf as $configGroup => $configGroupSettings) {
         foreach ($configGroupSettings as $confName => $confValue) {
             $GLOBALS['_MAX']['CONF'][$configGroup][$confName] = $confValue;
         }
     }
     // Switch off audit
     $GLOBALS['_MAX']['CONF']['audit']['enabled'] = false;
 }