public function tearDown()
    {
        ezpINIHelper::restoreINISettings();
        eZClusterFileHandler::resetHandler();

        parent::tearDown();
    }
 public static function setUpDatabase()
 {
     $dsn = ezpTestRunner::dsn()->parts;
     switch ($dsn['phptype']) {
         case 'mysql':
             $backend = 'eZDFSFileHandlerMySQLBackend';
             break;
         case 'mysqli':
             $backend = 'eZDFSFileHandlerMySQLiBackend';
             break;
         case 'postgresql':
             $backend = 'eZDFSFileHandlerPostgresqlBackend';
             break;
         default:
             self::markTestSkipped("Unsupported database type '{$dsn['phptype']}'");
     }
     // We need to clear the existing handler if it was loaded before the INI
     // settings changes
     eZClusterFileHandler::resetHandler();
     if (isset($GLOBALS['eZClusterFileHandler_chosen_handler']) and !$GLOBALS['eZClusterFileHandler_chosen_handler'] instanceof eZDFSFileHandler) {
         unset($GLOBALS['eZClusterFileHandler_chosen_handler']);
     }
     unset($GLOBALS['eZClusterInfo']);
     // Load database parameters for cluster
     // The same DSN than the relational database is used
     ezpINIHelper::setINISetting('file.ini', 'ClusteringSettings', 'FileHandler', 'eZDFSFileHandler');
     ezpINIHelper::setINISetting('file.ini', 'eZDFSClusteringSettings', 'DBHost', $dsn['host']);
     ezpINIHelper::setINISetting('file.ini', 'eZDFSClusteringSettings', 'DBPort', $dsn['port']);
     ezpINIHelper::setINISetting('file.ini', 'eZDFSClusteringSettings', 'DBSocket', $dsn['socket']);
     ezpINIHelper::setINISetting('file.ini', 'eZDFSClusteringSettings', 'DBName', $dsn['database']);
     ezpINIHelper::setINISetting('file.ini', 'eZDFSClusteringSettings', 'DBUser', $dsn['user']);
     ezpINIHelper::setINISetting('file.ini', 'eZDFSClusteringSettings', 'DBPassword', $dsn['password']);
     ezpINIHelper::setINISetting('file.ini', 'eZDFSClusteringSettings', 'MountPointPath', self::getDfsPath());
     ezpINIHelper::setINISetting('file.ini', 'eZDFSClusteringSettings', 'DBBackend', $backend);
 }
 public function tearDown()
 {
     // restore the previous file handler
     if ($this->previousFileHandler !== null) {
         $fileINI = eZINI::instance('file.ini');
         $fileINI->setVariable('ClusteringSettings', 'FileHandler', $this->previousFileHandler);
         $this->previousFileHandler = null;
         eZClusterFileHandler::resetHandler();
     }
     if ($this->haveToRemoveDFSPath) {
         eZDir::recursiveDelete($this->DFSPath);
     }
     parent::tearDown();
 }
 /**
  * Test setup
  *
  * Load an instance of file.ini
  * Assigns DB parameters for cluster
  **/
 public function setUp()
 {
     parent::setUp();
     $dsn = ezpTestRunner::dsn()->parts;
     switch ($dsn['phptype']) {
         case 'mysql':
             $backend = 'eZDBFileHandlerMysqlBackend';
             break;
         case 'mysqli':
             $backend = 'eZDBFileHandlerMysqliBackend';
             break;
         case 'postgresql':
             $backend = 'eZDBFileHandlerPostgresqlBackend';
             break;
         default:
             $this->markTestSkipped("Unsupported database type '{$dsn['phptype']}'");
     }
     // We need to clear the existing handler if it was loaded before the INI
     // settings changes
     eZClusterFileHandler::resetHandler();
     // We need to clear the existing handler if it was loaded before the INI
     // settings changes
     if (isset($GLOBALS['eZClusterFileHandler_chosen_handler']) and !$GLOBALS['eZClusterFileHandler_chosen_handler'] instanceof eZDBFileHandler) {
         unset($GLOBALS['eZClusterFileHandler_chosen_handler']);
     }
     unset($GLOBALS['eZClusterInfo']);
     // Load database parameters for cluster
     // The same DSN than the relational database is used
     ezpINIHelper::setINISetting('file.ini', 'ClusteringSettings', 'FileHandler', $this->clusterClass);
     ezpINIHelper::setINISetting('file.ini', 'ClusteringSettings', 'DBHost', $dsn['host']);
     ezpINIHelper::setINISetting('file.ini', 'ClusteringSettings', 'DBPort', $dsn['port']);
     ezpINIHelper::setINISetting('file.ini', 'ClusteringSettings', 'DBSocket', $dsn['socket']);
     ezpINIHelper::setINISetting('file.ini', 'ClusteringSettings', 'DBName', $dsn['database']);
     ezpINIHelper::setINISetting('file.ini', 'ClusteringSettings', 'DBUser', $dsn['user']);
     ezpINIHelper::setINISetting('file.ini', 'ClusteringSettings', 'DBPassword', $dsn['password']);
     ezpINIHelper::setINISetting('file.ini', 'ClusteringSettings', 'DBBackend', $backend);
     $this->db = $this->sharedFixture;
 }
 public function tearDown()
 {
     ezpINIHelper::restoreINISettings();
     eZClusterFileHandler::resetHandler();
     if ($this->haveToRemoveDFSPath) {
         eZDir::recursiveDelete(self::$DFSPath);
     }
     parent::tearDown();
 }