I am writings functional tests for my projects' backend application modules. To test some features, I need to simulate user actions from frontend application. So, I created 2
sfTestFunctional instances:
$frontendBrowser = new frontendTestFunctional();
$backendBrowser = new backendTestFunctional();
These classes basically inherit from sfTestFunctional. Now, as we know, each application in symfony has its own context instance, so we have to switch to it first:
sfContext::switchTo('frontend');
//this works fine
$frontendBrowser->
get('/home');
sfContext::switchTo('backend');
//the following fails with a misirable error: Cannot redeclare class homeComponents
$backendBrowser->
get('/home');
So, the problem is that both pages have their own classes with the same name (homeComponents) that obviously cannot be included in one script. Is there anything I can do about it?
P.S the question is not necessarily Symfony related, so I also tag it 'php'
update: Seems like the only solution is to rename all the modules in one application, so that action and components classes have different names. But this is very involved.