示例#1
0
 /**
  * Constructor
  *
  * Initialize environment, root path, and configuration.
  *
  * @param  string $env
  * @param  string|null $root
  * @return void
  */
 public function __construct($env, $root = null)
 {
     $this->_setEnv($env);
     if (null === $root) {
         $root = realpath(dirname(__FILE__) . '/../');
     }
     $this->_root = $root;
     $this->initPhpConfig();
     $this->_front = Zend_Controller_Front::getInstance();
     date_default_timezone_set('UTC');
     // set the test environment parameters
     if (true || $env == 'test') {
         // Enable all errors so we'll know when something goes wrong.
         error_reporting(E_ALL | E_STRICT);
         ini_set('display_startup_errors', 1);
         ini_set('display_errors', 1);
         $this->_front->throwExceptions(true);
     }
     $configFile = dirname(__FILE__) . '/config.xml';
     require_once 'Zend/Config/Xml.php';
     self::$_config = new Zend_Config_Xml($configFile, $this->_env);
     require_once 'Zend/Registry.php';
     Zend_Registry::set('Config', self::$_config);
 }