I am trying to test a model with a fixture. Nothing special, but in this case I am using two databases.
The DB's are in both setup main.php and test.php config files. The first db is named 'db', the second 'routedb'. The second DB has a 'class' => 'CDbConnection' (it's working while non-testing).
The Model has a public function
so it should select the other db.
But while testing with fixtures, it says
Of course, this table exists in 'routedb'.
I work around this with commenting out the original 'db' and renaming 'routedb' to 'db', but that not the way I like it...
Is it possible to unittest with multiple databases? How do I do this?
The DB's are in both setup main.php and test.php config files. The first db is named 'db', the second 'routedb'. The second DB has a 'class' => 'CDbConnection' (it's working while non-testing).
The Model has a public function
public function getDbConnection() {
return Yii::app()->routedb;
}so it should select the other db.
But while testing with fixtures, it says
CException: Table 'tbl_route' does not exist.
Of course, this table exists in 'routedb'.
I work around this with commenting out the original 'db' and renaming 'routedb' to 'db', but that not the way I like it...
Is it possible to unittest with multiple databases? How do I do this?