From 6612dd6ddbaf91b2defff57accfedd7650576897 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 20 Oct 2013 14:46:00 -0400 Subject: [PATCH] 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. --- Cake/TestSuite/Fixture/FixtureManager.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Cake/TestSuite/Fixture/FixtureManager.php b/Cake/TestSuite/Fixture/FixtureManager.php index f0c59df50f6..4f0ee866e01 100644 --- a/Cake/TestSuite/Fixture/FixtureManager.php +++ b/Cake/TestSuite/Fixture/FixtureManager.php @@ -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); } }