The testdrive demo app is configured for this - after you install, note the separate index-test.php
, and protected/config/test.php
.
Unlike @IvanButtinoni's suggestion, you'll need to access index-test.php
, instead of index.php
, so you may need to modify your .htaccess if you're using clean URLs to allow access to index-test.php
.
When I do this, I usually write a custom init in the base controller.php:
public function init() {
// use test layout if using test config
if (isset(Yii::app()->params['test'])) {
$this->layout='//layouts/test';
}
parent::init();
}
Obviously, I have a test parameter in my test.php . . .
The only difference in my two layouts is that one sets the background color to be a bright yellow, just so it's very clear you're on a test site.