public function setUp() { $this->_controller = Controller\Front::getInstance(); $this->_controller->resetInstance(); $this->_controller->setControllerDirectory(__DIR__ . DIRECTORY_SEPARATOR . '_files')->setParam('noErrorHandler', true)->setParam('noViewRenderer', true)->returnResponse(true)->throwExceptions(false); HelperBroker::resetHelpers(); }
public function setUp() { $this->front = FrontController::getInstance(); $this->front->resetInstance(); $this->front->setParam('noViewRenderer', true)->setParam('noErrorHandler', true)->throwExceptions(true); HelperBroker::resetHelpers(); $viewRenderer = HelperBroker::getStaticHelper('viewRenderer'); $viewRenderer->setActionController(); }
public function setUp() { $this->clearRegistry(); Form::setDefaultTranslator(null); if (isset($this->error)) { unset($this->error); } ActionHelperBroker::resetHelpers(); $this->form = new Form(); }
public function setUp() { Registry::_unsetInstance(); Form::setDefaultTranslator(null); if (isset($this->error)) { unset($this->error); } $this->element = new Element('foo'); HelperBroker::resetHelpers(); }
public function setUp() { Registry::_unsetInstance(); Form::setDefaultTranslator(null); if (isset($this->error)) { unset($this->error); } ActionHelperBroker::resetHelpers(); $this->loader = new PluginLoader(array('Zend\\Form\\Decorator' => 'Zend/Form/Decorator')); $this->group = new DisplayGroup('test', $this->loader); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Layout::resetMvcInstance(); HelperBroker::resetHelpers(); HelperBroker::setPluginLoader(null); $this->request = new HTTPRequest(); $this->response = new CLIResponse(); $this->front = FrontController::getInstance(); $this->front->resetInstance(); $this->front->setRequest($this->request)->setResponse($this->response); $this->viewRenderer = HelperBroker::getStaticHelper('viewRenderer'); $this->layout = Layout::startMvc(); }
public function setUp() { // Store original autoloaders $this->loaders = spl_autoload_functions(); if (!is_array($this->loaders)) { // spl_autoload_functions does not return empty array when no // autoloaders registered... $this->loaders = array(); } Autoloader::resetInstance(); $this->autoloader = Autoloader::getInstance(); $this->application = new Application('testing'); $this->bootstrap = new ZfAppBootstrap($this->application); HelperBroker::resetHelpers(); }
protected function setUp() { if (!extension_loaded('pdo_sqlite')) { $this->markTestSkipped('Pdo_Sqlite extension is not loaded'); } $this->_adapter = new \Zend\Db\Adapter\Pdo\Sqlite(array('dbname' => __DIR__ . '/_files/test.sqlite')); $this->_query = $this->_adapter->select()->from('test'); $this->_testCollection = range(1, 101); $this->_paginator = Paginator\Paginator::factory($this->_testCollection); $this->_config = new Config\Xml(__DIR__ . '/_files/config.xml'); // get a fresh new copy of ViewRenderer in each tests HelperBroker::resetHelpers(); $fO = array('lifetime' => 3600, 'automatic_serialization' => true); $bO = array('cache_dir' => $this->_getTmpDir()); $this->_cache = \Zend\Cache\Cache::factory('Core', 'File', $fO, $bO); Paginator\Paginator::setCache($this->_cache); $this->_restorePaginatorDefaults(); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { \Zend\Layout\Layout::resetMvcInstance(); HelperBroker::resetHelpers(); $this->front = Controller\Front::getInstance(); $this->front->resetInstance(); $this->front->addModuleDirectory(__DIR__ . '/../../_files/modules'); $this->layout = Layout\Layout::startMvc(); $this->helper = new Helper\ContextSwitch(); HelperBroker::addHelper($this->helper); $this->request = new \Zend\Controller\Request\Http(); $this->response = new \Zend\Controller\Response\Cli(); $this->front->setRequest($this->request)->setResponse($this->response)->addControllerDirectory(__DIR__); $this->view = new \Zend\View\View(); $this->viewRenderer = HelperBroker::getStaticHelper('viewRenderer'); $this->viewRenderer->setView($this->view); $this->controller = new ContextSwitchTestController($this->request, $this->response, array()); $this->controller->setupContexts(); $this->helper->setActionController($this->controller); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { unset($_SERVER['HTTP_X_REQUESTED_WITH']); } \Zend\Layout\Layout::resetMvcInstance(); HelperBroker::resetHelpers(); HelperBroker::addPrefix('Zend\\Controller\\Action\\Helper'); $this->front = \Zend\Controller\Front::getInstance(); $this->front->resetInstance(); $this->front->addModuleDirectory(__DIR__ . '/../../_files/modules'); $this->layout = Layout\Layout::startMvc(); $this->helper = new \Zend\Controller\Action\Helper\AjaxContext(); $this->request = new \Zend\Controller\Request\Http(); $this->response = new \Zend\Controller\Response\Cli(); $this->front->setRequest($this->request)->setResponse($this->response); $this->view = new \Zend\View\View(); $this->view->addHelperPath(__DIR__ . '/../../../../../library/Zend/View/Helper/'); $this->viewRenderer = HelperBroker::getStaticHelper('viewRenderer'); $this->viewRenderer->setView($this->view); $this->controller = new AjaxContextTestController($this->request, $this->response, array()); $this->helper->setActionController($this->controller); }
/** * Reset MVC state * * Creates new request/response objects, resets the front controller * instance, and resets the action helper broker. * * @todo Need to update Zend_Layout to add a resetInstance() method * @return void */ public function reset() { $_SESSION = array(); $_GET = array(); $_POST = array(); $_COOKIE = array(); $this->resetRequest(); $this->resetResponse(); \Zend\Layout\Layout::resetMvcInstance(); HelperBroker::resetHelpers(); $this->frontController->resetInstance(); //\Zend\Session\Manager::$_unitTestEnabled = true; }
/** * Resets all object properties of the singleton instance * * Primarily used for testing; could be used to chain front controllers. * * Also resets action helper broker, clearing all registered helpers. * * @return void */ public function resetInstance() { $reflection = new \ReflectionObject($this); foreach ($reflection->getProperties() as $property) { $name = $property->getName(); switch ($name) { case '_instance': break; case '_controllerDir': case '_invokeParams': $this->{$name} = array(); break; case '_plugins': $this->{$name} = new Plugin\Broker(); break; case '_throwExceptions': case '_returnResponse': $this->{$name} = false; break; case '_moduleControllerDirectoryName': $this->{$name} = 'controllers'; break; default: $this->{$name} = null; break; } } Action\HelperBroker::resetHelpers(); }
/** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. * * @access protected */ protected function tearDown() { HelperBroker::resetHelpers(); }