Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit e0f2474

Browse files
Michael GraueryuzhengZ
authored andcommitted
BUG: refs #0283. Released lock files at end and fixed core upgrades.
The db lock.dbtype.ini files were created at the beginning, but never released, now at the end of processing they are released. Also, there was a bug where core upgrades were not run, now all core upgrades are run after installing the core schema.
1 parent 573e819 commit e0f2474

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

tests/DatabaseSetup.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ function loadDbAdapter($testConfigDir, $dbType)
3131
$lockFile = $testConfigDir . '/lock.' . $dbType . '.ini';
3232
copy($dbConfigFile, $lockFile);
3333

34-
// TODO what are these lockfiles for even
35-
// they don't seem to do anything
3634
// load the lockfile as the test dbConfig
3735
if(file_exists($lockFile))
3836
{
@@ -99,15 +97,18 @@ function installCore($db, $dbType, $utilityComponent)
9997
{
10098
case 'mysql':
10199
$utilityComponent->run_mysql_from_file($sqlFile, $databaseConfig['host'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['dbname'], $databaseConfig['port']);
100+
$upgradeDbType = "PDO_MYSQL";
102101
break;
103102
case 'pgsql':
104103
$utilityComponent->run_pgsql_from_file($sqlFile, $databaseConfig['host'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['dbname'], $databaseConfig['port']);
104+
$upgradeDbType = "PDO_PGSQL";
105105
break;
106106
default:
107107
throw new Zend_Exception("Unknown db type: ".$dbType);
108108
break;
109109
}
110110

111+
$upgradeComponent->initUpgrade('core', $db, $upgradeDbType);
111112
$upgradeComponent->upgrade(str_replace('.sql', '', basename($sqlFile)), true /* true for testing */);
112113
}
113114

@@ -163,6 +164,22 @@ function installModules($utilityComponent)
163164
}
164165
}
165166

167+
// cleanup the lock files
168+
function releaseLocks()
169+
{
170+
if(file_exists(BASE_PATH.'/tests/configs/lock.pgsql.ini'))
171+
{
172+
rename( BASE_PATH.'/tests/configs/lock.pgsql.ini',BASE_PATH.'/tests/configs/pgsql.ini');
173+
}
174+
if(file_exists(BASE_PATH.'/tests/configs/lock.mysql.ini'))
175+
{
176+
rename( BASE_PATH.'/tests/configs/lock.mysql.ini',BASE_PATH.'/tests/configs/mysql.ini');
177+
}
178+
}
179+
180+
181+
182+
166183

167184

168185

@@ -262,6 +279,8 @@ function installModules($utilityComponent)
262279
installCore($dbAdapter, $dbType, $utilityComponent);
263280
createDefaultAssetstore();
264281
installModules($utilityComponent);
282+
283+
releaseLocks();
265284
}
266285
catch(Zend_Exception $ze)
267286
{

0 commit comments

Comments
 (0)