/**
  * Test setup
  *
  * Load an instance of file.ini
  * Assigns DB parameters for cluster
  **/
 public function setUp()
 {
     if (!$this->sharedFixture instanceof eZMySQLDB) {
         self::markTestSkipped("Not using mysql interface, skipping");
     }
     parent::setUp();
     // 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']);
     }
     // 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;
     $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;
     }
     ezpTestDatabaseHelper::insertSqlData($this->sharedFixture, $this->sqlFiles);
     $this->db = $this->sharedFixture;
 }
Ejemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     // make sure extension is enabled and settings are read
     ezpExtensionHelper::load('ezfind');
     $sqlFiles = array('extension/ezfind/sql/mysql/mysql.sql');
     ezpTestDatabaseHelper::insertSqlData($this->sharedFixture, $sqlFiles);
 }
Ejemplo n.º 3
0
 protected function setUp()
 {
     if (ezpTestRunner::dsn()->dbsyntax !== "postgresql") {
         self::markTestSkipped("Not running PostgresSQL, skipping");
     }
     parent::setUp();
     ezpTestDatabaseHelper::clean($this->sharedFixture);
 }
Ejemplo n.º 4
0
 public static function tearDownAfterClass()
 {
     // We need to clean up after this test case, since database will not
     // be reset by the suite it initialisation has happened once, see pull req. #234
     // Next: Suite which always prepares the db for you.
     $db = ezpTestDatabaseHelper::create(ezpTestRunner::dsn());
     ezpTestDatabaseHelper::clean($db);
     ezpTestDatabaseHelper::insertDefaultData($db);
 }
Ejemplo n.º 5
0
 protected function setUp()
 {
     if (!in_array(ezpTestRunner::dsn()->dbsyntax, array('mysql', 'mysqli'))) {
         self::markTestSkipped("Not running MySQL nor MysQLi, skipping");
     }
     parent::setUp();
     // clean up the database so that the tests are independant from the ezp database
     ezpTestDatabaseHelper::clean($this->sharedFixture);
 }
    /**
     * 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;
    }
Ejemplo n.º 7
0
 /**
  * Sets up the database enviroment
  */
 protected function setUp()
 {
     if (ezpTestRunner::dbPerTest()) {
         $dsn = ezpTestRunner::dsn();
         $this->sharedFixture = ezpTestDatabaseHelper::create($dsn);
         if ($this->insertDefaultData === true) {
             ezpTestDatabaseHelper::insertDefaultData($this->sharedFixture);
         }
         if (count($this->sqlFiles > 0)) {
             ezpTestDatabaseHelper::insertSqlData($this->sharedFixture, $this->sqlFiles);
         }
     }
     eZDB::setInstance($this->sharedFixture);
 }
 public function setUp()
 {
     parent::setUp();
     ezpTestDatabaseHelper::insertSqlData($this->sharedFixture, $this->sqlFiles);
 }