How To Stay/call On Index-Test Url, Phpunit + Selenium.

Hi, I’m using selenium server with phpunit to run tests on my yii website. In order to avoid confusion I use two different databases in order to run my tests in one side and use it in other side. When I use it, the main /index.php with the config/main.php is called but when I run test I would like that it be index-test.php and config/test.php for all the test.

When I launch my tests, I see well selenium calling the good index-test.php for launching browser however at the first test step (click on login for example) it comes back to use the main index.php which breaks my tests because this uses the wrong database.

I thought it was maybe because of my url manager. So I copied them from config/main.php to config/test.php substituing index.php by index-test.php like :




      'urlManager'=>array(

        'class'=>'application.components.UrlManager',

        'urlFormat'=>'path',

        /*'rules'=>array(

          '<controller:\w+>/<id:\d+>'=>'<controller>/view',

          '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

          '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',*/

        'rules'=>array(

          '<language:(gv|en)>/<controller:\w+>/<action:\w+>' => '<controller>/<action>',

          '<language:(gv|en)>/' => 'site/index-test', //index -> index-test

          '<language:(gv|en)>/<action:(contact|login|logout)>/*' => 'site/<action>',

          '<language:(gv|en)>/<controller:\w+>/<id:\d+>'=>'<controller>/view',

          '<language:(gv|en)>/<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

          '<language:(gv|en)>/<controller:\w+>/<action:\w+>/*'=>'<controller>/<action>',

        ),

        'showScriptName'=>false,

      ),



But it still doesn’t work.

Now I think if this would not come from the rules written in order to hide the index.php from the url… but I don’t know…

Do you have an idea ?

Half solved, I needed first to change the link call in config/test.php adding the language prefix.

Secondly I had to change the lighttpd rule wich rewrite url :

url.rewrite-if-not-file = ( "^/App/(.*)$" => "/App/index-test.php/$1")

however, I wonder how I can automate that in order to not have to change lighttpd.conf every time I run my test