I’m doing some selenium test cases using the yii webdriver extension and I have a problem with the databases. I have the DEV database and the TEST database which I configured in the main.php and in the test.php. The fixtures, the unit test cases and the setup of the selenium’s tests works perfectly in the TEST database, but when the browser is being used by selenium, it uses the DEV database.
<?php
// change the following paths if necessary
$yiit=dirname(__FILE__).'/../../../Yii_framework/framework/yiit.php';
$config=dirname(__FILE__).'/../config/test.php';
require_once($yiit);
//require_once(dirname(__FILE__).'/WebTestCase.php'); - since I'm using the webdriver extension, this is not necessary
Yii::createWebApplication($config);
Anyone has any idea why the override is not working?
<?php
/**
* Change the following URL based on your server configuration
* Make sure the URL ends with a slash so that we can use relative URLs in test cases
*/
define('TEST_BASE_URL','http://localhost/Rafao_server/Yii_KombatoOnline/index-test.php/');
/**
* The base class for functional test cases.
* In this class, we set the base URL for the test application.
* We also provide some common methods to be used by concrete test classes.
*/
class WebTestCase extends CWebTestCase
{
/**
* Sets up before each test method runs.
* This mainly sets the base URL for the test application.
*/
protected function setUp()
{
parent::setUp();
$this->setBrowserUrl(TEST_BASE_URL);
}
}
here is the index-test.php
<?php
/**
* This is the bootstrap file for test application.
* This file should be removed when the application is deployed for production.
*/
// change the following paths if necessary
$yii=dirname(__FILE__).'/../Yii_framework/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/test.php';
// remove the following line when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
require_once($yii);
Yii::createWebApplication($config)->run();