Skip to content

Commit

Permalink
Make connection aliasing more thorough.
Browse files Browse the repository at this point in the history
Use either test prefixed or unprefixed connections to create the alias
map. This allows only the test connections to be defined in
configuration for CI servers, and still correctly alias the standard
connection names.
  • Loading branch information
markstory committed Oct 20, 2013
1 parent 3f66a22 commit 6612dd6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Cake/TestSuite/Fixture/FixtureManager.php
Expand Up @@ -88,14 +88,20 @@ public function fixturize($test) {
protected function _aliasConnections() {
$connections = ConnectionManager::configured();
ConnectionManager::alias('test', 'default');
$map = [
'test' => 'default',
];
foreach ($connections as $connection) {
if ($connection === 'default') {
if (isset($map[$connection])) {
continue;
}
if (strpos($connection, 'test') === 0) {
continue;
if (strpos($connection, 'test_') === 0) {
$map[$connection] = substr($connection, 5);
} else {
$map['test_' . $connection] = $connection;
}
$alias = 'test_' . $connection;
}
foreach ($map as $alias => $connection) {
ConnectionManager::alias($alias, $connection);
}
}
Expand Down

0 comments on commit 6612dd6

Please sign in to comment.