Browse Source

Finish fixing connection aliasing.

The code in #8414 removed the defaultConnectionName from a test model.
This shouldn't have been removed as it was exposing an issue in #8414.

Refs #8414
Mark Story 10 years ago
parent
commit
9514316541

+ 1 - 1
src/TestSuite/Fixture/FixtureManager.php

@@ -139,7 +139,7 @@ class FixtureManager
             }
         }
         foreach ($map as $alias => $connection) {
-            ConnectionManager::alias($connection, $alias);
+            ConnectionManager::alias($alias, $connection);
         }
     }
 

+ 1 - 0
tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php

@@ -93,6 +93,7 @@ class TranslateBehaviorTest extends TestCase
 
         $this->assertEquals('\TestApp\Model\Table\I18nTable', $i18n->name());
         $this->assertInstanceOf('TestApp\Model\Table\I18nTable', $i18n->target());
+        $this->assertEquals('test_custom_i18n_datasource', $i18n->target()->connection()->configName());
         $this->assertEquals('custom_i18n_table', $i18n->target()->table());
     }
 

+ 5 - 0
tests/test_app/TestApp/Model/Table/I18nTable.php

@@ -24,4 +24,9 @@ class I18nTable extends Table
     {
         $this->table('custom_i18n_table');
     }
+
+    public static function defaultConnectionName()
+    {
+        return 'custom_i18n_datasource';
+    }
 }