示例#1
0
文件: Abstract.php 项目: robeendey/ce
 /**
  * Constructor
  * 
  * @param Engine_Application $application
  */
 public function __construct($application)
 {
     // Get options
     if ($application instanceof Engine_Application) {
         $options = $application->getOptions();
         $autoloader = $application->getAutoloader();
     } else {
         if ($application instanceof Engine_Application_Bootstrap_Abstract) {
             $options = $application->getApplication()->getOptions();
             $autoloader = $application->getApplication()->getAutoloader();
         } else {
             throw new Engine_Application_Bootstrap_Exception('Application not instance of Engine_Application or Engine_Application_Bootstrap_Abstract');
         }
     }
     $this->_application = $application;
     $this->setOptions($options);
     Engine_Api::_()->setModuleBootstrap($this);
     $autoloader->register($this->getModuleName(), $this->getModulePath());
 }
示例#2
0
 public function _before(\Codeception\TestCase $test)
 {
     // Create application, bootstrap, and run
     $this->bootstrap = new \Engine_Application(array('environment' => APPLICATION_ENV, 'bootstrap' => array('path' => APPLICATION_PATH_COR . DS . 'modules' . DS . APPLICATION_NAME . DS . 'Bootstrap.php', 'class' => ucfirst(APPLICATION_NAME) . '_Bootstrap'), 'autoloaderNamespaces' => array('Zend' => APPLICATION_PATH_LIB . DS . 'Zend', 'Engine' => APPLICATION_PATH_LIB . DS . 'Engine', 'Facebook' => APPLICATION_PATH_LIB . DS . 'Facebook', 'Bootstrap' => APPLICATION_PATH_BTS, 'Plugin' => APPLICATION_PATH_PLU, 'Widget' => APPLICATION_PATH_WID)));
     \Zend_Session::$_unitTestEnabled = true;
     \Engine_Application::setInstance($this->bootstrap);
     \Engine_Api::getInstance()->setApplication($this->bootstrap);
     $this->bootstrap->bootstrap();
     $this->client->setBootstrap($this->bootstrap);
 }
            define('_ENGINE_R_MAIN', 'lite.php');
            define('_ENGINE_R_INIT', true);
        } else {
            define('_ENGINE_R_MAIN', false);
            define('_ENGINE_R_INIT', true);
        }
    }
}
// Boot
if (_ENGINE_R_INIT) {
    // Application
    require_once 'Engine/Loader.php';
    require_once 'Engine/Application.php';
    // Create application, bootstrap, and run
    $application = new Engine_Application(array('environment' => APPLICATION_ENV, 'bootstrap' => array('path' => APPLICATION_PATH_COR . DS . 'modules' . DS . APPLICATION_NAME . DS . 'Bootstrap.php', 'class' => ucfirst(APPLICATION_NAME) . '_Bootstrap'), 'autoloaderNamespaces' => array('Zend' => APPLICATION_PATH_LIB . DS . 'Zend', 'Engine' => APPLICATION_PATH_LIB . DS . 'Engine', 'Facebook' => APPLICATION_PATH_LIB . DS . 'Facebook', 'Bootstrap' => APPLICATION_PATH_BTS, 'Plugin' => APPLICATION_PATH_PLU, 'Widget' => APPLICATION_PATH_WID)));
    Engine_Application::setInstance($application);
    Engine_Api::getInstance()->setApplication($application);
}
// config mode
if (defined('_ENGINE_R_CONF') && _ENGINE_R_CONF) {
    return;
}
// Sub apps
if (_ENGINE_R_MAIN) {
    require dirname(__FILE__) . DS . _ENGINE_R_MAIN;
    exit;
} else {
    $application->bootstrap();
    $application->run();
}
// Start trace
 public static function unsetInstance()
 {
     self::$_instance = null;
 }