Skip to content

Commit 6612dd6

Browse files
committed
Make connection aliasing more thorough.
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.
1 parent 3f66a22 commit 6612dd6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Cake/TestSuite/Fixture/FixtureManager.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,20 @@ public function fixturize($test) {
8888
protected function _aliasConnections() {
8989
$connections = ConnectionManager::configured();
9090
ConnectionManager::alias('test', 'default');
91+
$map = [
92+
'test' => 'default',
93+
];
9194
foreach ($connections as $connection) {
92-
if ($connection === 'default') {
95+
if (isset($map[$connection])) {
9396
continue;
9497
}
95-
if (strpos($connection, 'test') === 0) {
96-
continue;
98+
if (strpos($connection, 'test_') === 0) {
99+
$map[$connection] = substr($connection, 5);
100+
} else {
101+
$map['test_' . $connection] = $connection;
97102
}
98-
$alias = 'test_' . $connection;
103+
}
104+
foreach ($map as $alias => $connection) {
99105
ConnectionManager::alias($alias, $connection);
100106
}
101107
}

0 commit comments

Comments
 (0)