本文整理汇总了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);
}