Skip to content

Instantly share code, notes, and snippets.

@motin
Created July 17, 2014 10:36
Show Gist options
  • Save motin/aa7ac5ce0f07da2da4c7 to your computer and use it in GitHub Desktop.
Save motin/aa7ac5ce0f07da2da4c7 to your computer and use it in GitHub Desktop.
Yii unit test _bootstrap for codeception
<?php
$_SERVER['SCRIPT_FILENAME'] = 'index-test.php';
$_SERVER['SCRIPT_NAME'] = '/index-test.php';
$_SERVER['REQUEST_URI'] = 'index-test.php';
// change the following paths if necessary
$yiit=dirname(__FILE__).'/../../../vendor/yiisoft/yii/framework/yiit.php';
require_once($yiit);
$main=require(dirname(__FILE__).'/../../../app/config/main.php');
$env=require(dirname(__FILE__)."/../../../app/config/environments/" . CONFIG_ENVIRONMENT . ".php");
// require composer autoloader
require_once(dirname(__FILE__).'/../../../vendor/autoload.php');
$config = CMap::mergeArray($main, $env);
$config['components']['db'] = $config['components']['dbTest'];
if (!Yii::app()) Yii::createWebApplication($config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment