Skip to content

Commit

Permalink
Fix testing when some Sql drivers are tested, but others are not avai…
Browse files Browse the repository at this point in the history
…lable.

Since $db and $migrator are static, even if self::$db fails,
self::$migrator may contain the previous test's migration object.
  • Loading branch information
mrubinsk committed Feb 15, 2014
1 parent 41f1bfd commit cd5df36
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions framework/ActiveSync/test/Horde/ActiveSync/StateTest/Sql/Base.php
Expand Up @@ -197,20 +197,22 @@ public static function setUpBeforeClass()
error_reporting(E_ALL | E_STRICT);
}
self::$logger = new Horde_Test_Log();
self::$migrator = new Horde_Db_Migration_Migrator(
self::$db,
self::$logger->getLogger(),
array('migrationsPath' => $dir,
'schemaTableName' => 'horde_activesync_test_schema'));
self::$migrator->up();
if (self::$db) {
self::$migrator = new Horde_Db_Migration_Migrator(
self::$db,
self::$logger->getLogger(),
array('migrationsPath' => $dir,
'schemaTableName' => 'horde_activesync_test_schema'));
self::$migrator->up();
}
}

public static function tearDownAfterClass()
{
if (self::$migrator) {
self::$migrator->down();
}
if (self::$db) {
if (self::$migrator) {
self::$migrator->down();
}
self::$db->disconnect();
self::$db = null;
}
Expand Down

0 comments on commit cd5df36

Please sign in to comment.