Permalink
Browse files

Fixed the initialization of unit tests related to file handlers and c…

…luster systems
  • Loading branch information...
dpobel committed Apr 4, 2012
1 parent 8335141 commit c329471f206599c0c1340209e61948e0bed58d5a
@@ -33,9 +33,7 @@ public function 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 eZDBFileHandler )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
unset( $GLOBALS['eZClusterInfo'] );
@@ -78,9 +76,7 @@ public function setUp()
public function tearDown()
{
ezpINIHelper::restoreINISettings();
-
- if ( isset( $GLOBALS['eZClusterFileHandler_chosen_handler'] ) )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
parent::tearDown();
}
@@ -56,9 +56,7 @@ public function 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 eZDBFileHandler )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
unset( $GLOBALS['eZClusterInfo'] );
@@ -79,9 +77,7 @@ public function setUp()
public function tearDown()
{
ezpINIHelper::restoreINISettings();
-
- if ( isset( $GLOBALS['eZClusterFileHandler_chosen_handler'] ) )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
parent::tearDown();
}
@@ -36,6 +36,7 @@ public function setUp()
parent::setUp();
$this->previousFileHandler = eZINI::instance( 'file.ini' )->variable( 'ClusteringSettings', 'FileHandler' );
+ eZClusterFileHandler::resetHandler();
$this->DFSPath = eZDFSFileHandlerTest::getDfsPath();
eZDFSFileHandlerTest::setUpDatabase();
@@ -57,8 +58,7 @@ public function tearDown()
$fileINI = eZINI::instance( 'file.ini' );
$fileINI->setVariable( 'ClusteringSettings', 'FileHandler', $this->previousFileHandler );
$this->previousFileHandler = null;
- if ( isset( $GLOBALS['eZClusterFileHandler_chosen_handler'] ) )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
}
if ( $this->haveToRemoveDFSPath )
@@ -46,6 +46,7 @@ public function __construct()
public function setUp()
{
parent::setUp();
+ eZClusterFileHandler::resetHandler();
self::setUpDatabase( $this->clusterClass );
@@ -82,9 +83,6 @@ public static function setUpDatabase()
// 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'] );
@@ -104,9 +102,7 @@ public static function setUpDatabase()
public function tearDown()
{
ezpINIHelper::restoreINISettings();
-
- if ( isset( $GLOBALS['eZClusterFileHandler_chosen_handler'] ) )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
if ( $this->haveToRemoveDFSPath )
{
@@ -29,9 +29,7 @@ public function 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 $this->clusterClass )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
// Load database parameters for cluster
// The same DSN than the relational database is used
@@ -41,9 +39,7 @@ public function setUp()
public function tearDown()
{
ezpINIHelper::restoreINISettings();
-
- if ( isset( $GLOBALS['eZClusterFileHandler_chosen_handler'] ) )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
parent::tearDown();
}
@@ -29,9 +29,7 @@ public function 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 $this->clusterClass )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
// Load database parameters for cluster
// The same DSN than the relational database is used
@@ -41,9 +39,7 @@ public function setUp()
public function tearDown()
{
ezpINIHelper::restoreINISettings();
-
- if ( isset( $GLOBALS['eZClusterFileHandler_chosen_handler'] ) )
- unset( $GLOBALS['eZClusterFileHandler_chosen_handler'] );
+ eZClusterFileHandler::resetHandler();
parent::tearDown();
}
@@ -30,8 +30,7 @@ public function setUp()
// We need to clear the existing handler if it was loaded before the INI
// settings changes
- if ( !eZClusterFileHandler::$globalHandler instanceof eZFSFileHandler )
- eZClusterFileHandler::$globalHandler = null;
+ eZClusterFileHandler::resetHandler();
// Load database parameters for cluster
// The same DSN than the relational database is used
@@ -42,7 +41,7 @@ public function tearDown()
{
ezpINIHelper::restoreINISettings();
- eZClusterFileHandler::$globalHandler = null;
+ eZClusterFileHandler::resetHandler();
parent::tearDown();
}

0 comments on commit c329471

Please sign in to comment.