Exemplo n.º 1
0
 /**
  * Test setup
  *
  * Load an instance of file.ini
  * Assigns DB parameters for cluster
  **/
 public function setUp()
 {
     parent::setUp();
     self::setUpDatabase($this->clusterClass);
     if (!file_exists(self::$DFSPath)) {
         eZDir::doMkdir(self::$DFSPath, 0755);
         $this->haveToRemoveDFSPath = true;
     }
     $this->db = eZDB::instance();
 }
    /**
     * Test setup
     *
     * Load an instance of file.ini
     * Assigns DB parameters for cluster
     */
    public function setUp()
    {
        if ( ezpTestRunner::dsn()->dbsyntax !== 'mysql' && ezpTestRunner::dsn()->dbsyntax !== 'mysqli' )
            self::markTestSkipped( "Not running MySQL, skipping" );

        parent::setUp();
        $this->sharedFixture = ezpTestDatabaseHelper::create( ezpTestRunner::dsn() );
        ezpTestDatabaseHelper::insertSqlData( $this->sharedFixture,  array( 'tests/tests/kernel/classes/clusterfilehandlers/sql/cluster_dfs_schema.sql' ) );

        // We need to clear the existing handler if it was loaded before the INI
        // settings changes
        if ( !eZClusterFileHandler::$globalHandler instanceof eZDFSFileHandler )
            eZClusterFileHandler::$globalHandler = null;

        unset( $GLOBALS['eZClusterInfo'] );

        // Load database parameters for cluster
        // The same DSN than the relational database is used
        $fileINI = eZINI::instance( 'file.ini' );
        $this->previousFileHandler = $fileINI->variable( 'ClusteringSettings', 'FileHandler' );
        $fileINI->setVariable( 'ClusteringSettings', 'FileHandler', 'eZDFSFileHandler' );

        $dsn = ezpTestRunner::dsn()->parts;
        switch ( $dsn['phptype'] )
        {
            case 'mysql':
                $backend = 'eZDFSFileHandlerMySQLBackend';
                break;

            case 'mysqli':
                $backend = 'eZDFSFileHandlerMySQLiBackend';
                break;

            default:
                $this->markTestSkipped( "Unsupported database type '{$dsn['phptype']}'" );
        }
        $fileINI->setVariable( 'eZDFSClusteringSettings', 'DBBackend', $backend );
        $fileINI->setVariable( 'eZDFSClusteringSettings', 'DBHost',    $dsn['host'] );
        $fileINI->setVariable( 'eZDFSClusteringSettings', 'DBPort',    $dsn['port'] );
        $fileINI->setVariable( 'eZDFSClusteringSettings', 'DBSocket',  $dsn['socket'] );
        $fileINI->setVariable( 'eZDFSClusteringSettings', 'DBName',    $dsn['database'] );
        $fileINI->setVariable( 'eZDFSClusteringSettings', 'DBUser',    $dsn['user'] );
        $fileINI->setVariable( 'eZDFSClusteringSettings', 'DBPassword', $dsn['password'] );
        $fileINI->setVariable( 'eZDFSClusteringSettings', 'MountPointPath', $this->DFSPath );

        if ( !file_exists( $this->DFSPath ) )
        {
            eZDir::doMkdir( $this->DFSPath, 0755 );
            $this->haveToRemoveDFSPath = true;
        }

        $this->db = $this->sharedFixture;
    }
Exemplo n.º 3
0
    /**
     * 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
        eZClusterFileHandler::resetHandler();

        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;
    }
Exemplo n.º 4
0
 /**
  * Test setup
  *
  * Load an instance of file.ini
  * Assigns DB parameters for cluster
  **/
 public function setUp()
 {
     parent::setUp();
     if (!$this->sharedFixture instanceof eZMySQLDB and !$this->sharedFixture instanceof eZMySQLiDB) {
         self::markTestSkipped("Not using mysql interface, skipping");
     }
     // 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 eZDFSFileHandler) {
         unset($GLOBALS['eZClusterFileHandler_chosen_handler']);
     }
     unset($GLOBALS['eZClusterInfo']);
     // Load database parameters for cluster
     // The same DSN than the relational database is used
     $fileINI = eZINI::instance('file.ini');
     $this->previousFileHandler = $fileINI->variable('ClusteringSettings', 'FileHandler');
     $fileINI->setVariable('ClusteringSettings', 'FileHandler', 'eZDFSFileHandler');
     $dsn = ezpTestRunner::dsn()->parts;
     switch ($dsn['phptype']) {
         case 'mysql':
             $backend = 'eZDFSFileHandlerMySQLBackend';
             break;
         case 'mysqli':
             $backend = 'eZDFSFileHandlerMySQLiBackend';
             break;
         default:
             $this->markTestSkipped("Unsupported database type '{$dsn['phptype']}'");
     }
     $fileINI->setVariable('eZDFSClusteringSettings', 'DBBackend', $backend);
     $fileINI->setVariable('eZDFSClusteringSettings', 'DBHost', $dsn['host']);
     $fileINI->setVariable('eZDFSClusteringSettings', 'DBPort', $dsn['port']);
     $fileINI->setVariable('eZDFSClusteringSettings', 'DBSocket', $dsn['socket']);
     $fileINI->setVariable('eZDFSClusteringSettings', 'DBName', $dsn['database']);
     $fileINI->setVariable('eZDFSClusteringSettings', 'DBUser', $dsn['user']);
     $fileINI->setVariable('eZDFSClusteringSettings', 'DBPassword', $dsn['password']);
     $fileINI->setVariable('eZDFSClusteringSettings', 'MountPointPath', $this->DFSPath);
     if (!file_exists($this->DFSPath)) {
         eZDir::doMkdir($this->DFSPath, 0755);
         $this->haveToRemoveDFSPath = true;
     }
     $this->db = $this->sharedFixture;
 }