mercredi 25 mars 2015

CakePHP can not find table for model with another dbconfig in tests

I have a chain:



MyControllerTest ->
testAction(...) ->
MyController ->
uses (Model1, Model2) ->
Model1->method(), Model2->method() ....


Model1 has a default dbConfig, but Model2 uses another one:



...
public $useDbConfig = 'ConfigName';
...


On start test, Model2 fails: table %table% not found.


Bypassing the unit-test, directly from browser, it works.


How do I can force valid dbConfig in Model2 in my test?


Aucun commentaire:

Enregistrer un commentaire