当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseTest::__construct方法代码示例

本文整理汇总了PHP中DatabaseTest::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseTest::__construct方法的具体用法?PHP DatabaseTest::__construct怎么用?PHP DatabaseTest::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DatabaseTest的用法示例。


在下文中一共展示了DatabaseTest::__construct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Init the front for test it
  */
 public function __construct()
 {
     parent::__construct();
     $this->request = new Zend_Controller_Request_Http();
     $this->response = new Zend_Controller_Response_Http();
     $this->config = Phprojekt::getInstance()->getConfig();
     $this->config->language = "en";
     $this->request->setModuleName('Default');
     $this->request->setActionName('index');
     // Languages Set
     Zend_Loader::loadClass('Phprojekt_Language', PHPR_LIBRARY_PATH);
     $cache = Phprojekt::getInstance()->getCache();
     if (!($translate = $cache->load('Phprojekt_getTranslate_en'))) {
         $translate = new Phprojekt_Language(array('locale' => 'en'));
         $cache->save($translate, 'Phprojekt_getTranslate_en', array('Language'));
     }
     Zend_Registry::set('translate', $translate);
     $view = new Zend_View();
     $view->addScriptPath(PHPR_CORE_PATH . '/Default/Views/dojo/');
     $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
     $viewRenderer->setViewBasePathSpec(':moduleDir/Views');
     $viewRenderer->setViewScriptPathSpec(':action.:suffix');
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     /* Front controller stuff */
     $this->front = Zend_Controller_Front::getInstance();
     $this->front->setDispatcher(new Phprojekt_Dispatcher());
     $this->front->registerPlugin(new Zend_Controller_Plugin_ErrorHandler());
     $this->front->setDefaultModule('Default');
     $moduleDirectories = array();
     // System modules
     foreach (scandir(PHPR_CORE_PATH) as $module) {
         $dir = PHPR_CORE_PATH . DIRECTORY_SEPARATOR . $module;
         if (is_dir(!$dir)) {
             continue;
         }
         $helperPath = $dir . DIRECTORY_SEPARATOR . 'Helpers';
         if (is_dir($helperPath)) {
             $view->addHelperPath($helperPath, $module . '_' . 'Helpers');
             Zend_Controller_Action_HelperBroker::addPath($helperPath);
         }
         $dir = PHPR_CORE_PATH . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'SubModules';
         if (is_dir($dir)) {
             if ($module != 'Core') {
                 $moduleDirectories[] = $dir;
             } else {
                 $coreModules = scandir($dir);
                 foreach ($coreModules as $coreModule) {
                     $coreDir = $dir . DIRECTORY_SEPARATOR . $coreModule;
                     if ($coreModule != '.' && $coreModule != '..' && is_dir($coreDir)) {
                         $moduleDirectories[] = $coreDir;
                     }
                 }
             }
         }
     }
     // User modules
     foreach (scandir(PHPR_USER_CORE_PATH) as $module) {
         $dir = PHPR_USER_CORE_PATH . $module;
         if (is_dir(!$dir)) {
             continue;
         }
         $helperPath = $dir . DIRECTORY_SEPARATOR . 'Helpers';
         if (is_dir($helperPath)) {
             $view->addHelperPath($helperPath, $module . '_' . 'Helpers');
             Zend_Controller_Action_HelperBroker::addPath($helperPath);
         }
         $dir = PHPR_USER_CORE_PATH . $module . DIRECTORY_SEPARATOR . 'SubModules';
         if (is_dir($dir)) {
             $moduleDirectories[] = $dir;
         }
     }
     Zend_Registry::set('view', $view);
     $this->front->setModuleControllerDirectoryName('Controllers');
     $this->front->addModuleDirectory(PHPR_CORE_PATH);
     $this->front->addModuleDirectory(PHPR_USER_CORE_PATH);
     foreach ($moduleDirectories as $moduleDirectory) {
         $this->front->addModuleDirectory($moduleDirectory);
     }
     $this->front->setParam('useDefaultControllerAlways', true);
     $this->front->throwExceptions(true);
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:84,代码来源:FrontInit.php


注:本文中的DatabaseTest::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。