/** * * @see Zend_Application_Resource_Frontcontroller::getFrontController() * @return Centurion_Controller_Front */ public function getFrontController() { if (null === $this->_front) { $this->_front = Centurion_Controller_Front::getInstance(); } return $this->_front; }
public function tearDown() { global $application; Centurion_Controller_Front::getInstance()->resetInstance(); $this->resetRequest(); $this->resetResponse(); $this->request->setPost(array()); $this->request->setQuery(array()); Centurion_Signal::unregister(); Centurion_Auth::getInstance()->clearIdentity(); Centurion_Loader_PluginLoader::cleanCache(); return $application->getBootstrap()->bootstrap('cachemanager'); }
protected function getTestableModel() { global $application; $bootstrap = $application->getBootstrap(); $bootstrap->bootstrap('FrontController'); $bootstrap->bootstrap('modules'); $bootstrap->bootstrap('db'); $moduleRessource = $bootstrap->getResource('modules'); if (null == $this->_testableModel) { $this->_testableModel = array(); $front = Centurion_Controller_Front::getInstance(); $modules = $front->getControllerDirectory(); $moduleEnabled = Centurion_Config_Manager::get('resources.modules'); foreach ($modules as $moduleName => $module) { if (!in_array($moduleName, $moduleEnabled)) { continue; } $dbTableDir = realpath($module . '/../models/DbTable'); if (!file_exists($dbTableDir)) { continue; } $dir = new Centurion_Iterator_DbTableFilter($dbTableDir); foreach ($dir as $fileInfo) { $filename = $fileInfo->getFilenameWithoutExtension(); $className = sprintf('%s_Model_DbTable_%s', ucfirst($moduleName), $filename); $model = Centurion_Db::getSingletonByClassName($className); if (method_exists($model, 'getTestCondition')) { $testCondition = $model->getTestCondition(); if (null !== $testCondition) { $this->_testableModel[] = array($model, $model->getTestCondition()); } } } } } return $this->_testableModel; }