Yii Test bootstrap.php does not load global parameters

I tried running a PHPUnit test from Yii today (and eventually succeeded). But I bumped into some issues.

The bootstrap.php file, used to load the environment for testing, loads the main.php file containing all application settings. In our case, the main.php file contains a bunch of global parameters which are configured in the params.php file:




	'levels'=>'error, warning, info',




The bootstrap.php file however does not load the params.php file. This causes the execution of the main.php file to fail because of undifined constant errors:

PHP Notice: Use of undefined constant LOG_FILE - assumed ‘LOG_FILE’ in my/path/protected/config/main.php on line 94

I fixed it by adding some code to the bootstrap script which loads the params.php file (I found the code in the index.php file)

$config = dirname(__FILE__).'/protected/config/';

$config_params = $config.'params.php';


foreach($params as $key=>$value) {

	defined($key) or define($key, $value);


Now there are 2 possibilities:

  1. The bootstrap.php file should indeed load the params.php file in order to make it work (when using params in main.php) but for some reason the code is not in the bootstrap.php file.

  2. I’m missing something here and I shouldn’t have had any problems with the parameters used in the mail.php file.

Is there anybody who can clear this up?