Example #1
0
 /**
  * Set a non-default test configuration
  * @param $config string the id of the configuration to use
  * @param $configPath string (optional) where to find the config file, default: 'config'
  * @param $dbConnect (optional) whether to try to re-connect the data base, default: true
  */
 protected function setTestConfiguration($config, $configPath = 'config')
 {
     // Get the configuration file belonging to
     // this test configuration.
     $configFile = $this->getConfigFile($config, $configPath);
     // Avoid unnecessary configuration switches.
     if (Config::getConfigFileName() != $configFile) {
         // Switch the configuration file
         Config::setConfigFileName($configFile);
     }
 }
Example #2
0
 /**
  * Set a non-default test configuration
  * @param $config string the id of the configuration to use
  * @param $configPath string (optional) where to find the config file, default: 'config'
  * @param $dbConnect (optional) whether to try to re-connect the data base, default: true
  */
 protected function setTestConfiguration($config, $configPath = 'config', $dbConnect = true)
 {
     // Get the configuration file belonging to
     // this test configuration.
     $configFile = $this->getConfigFile($config, $configPath);
     // Avoid unnecessary configuration switches.
     if (Config::getConfigFileName() != $configFile) {
         // Switch the configuration file
         Config::setConfigFileName($configFile);
         // Re-open the database connection with the
         // new configuration.
         if ($dbConnect && class_exists('DBConnection')) {
             DBConnection::getInstance(new DBConnection());
         }
     }
 }
Example #3
0
 /**
  * @depends testGetVar
  * @covers Config::getVar
  * @covers Config::getData
  */
 public function testGetVarFromOtherConfig()
 {
     Config::setConfigFileName('lib/pkp/tests/config/config.pgsql.inc.php');
     self::assertEquals('pgsql', Config::getVar('database', 'driver'));
 }