Пример #1
0
 public function setUp()
 {
     $this->_controller = Controller\Front::getInstance();
     $this->_controller->resetInstance();
     $this->_controller->setControllerDirectory(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files')->setParam('noErrorHandler', true)->setParam('noViewRenderer', true)->returnResponse(true)->throwExceptions(false);
     HelperBroker\HelperBroker::resetHelpers();
 }
Пример #2
0
 public function setUp()
 {
     $this->front = \Zend\Controller\Front::getInstance();
     $this->front->resetInstance();
     $this->front->setParam('noViewRenderer', true)->setParam('noErrorHandler', true)->throwExceptions(true);
     HelperBroker\HelperBroker::resetHelpers();
     $viewRenderer = HelperBroker\HelperBroker::getStaticHelper('viewRenderer');
     $viewRenderer->setActionController();
 }
Пример #3
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 public function setUp()
 {
     $this->markTestSkipped('Skipped until DOJO is converted to Zend\\Dojo');
     \Zend\Layout\Layout::resetMvcInstance();
     HelperBroker\HelperBroker::resetHelpers();
     HelperBroker\HelperBroker::setPluginLoader(null);
     $this->request = new \Zend\Controller\Request\HTTP();
     $this->response = new \Zend\Controller\Response\Cli();
     $this->front = \Zend\Controller\Front::getInstance();
     $this->front->resetInstance();
     $this->front->setRequest($this->request)->setResponse($this->response);
     $this->viewRenderer = HelperBroker\HelperBroker::getStaticHelper('viewRenderer');
     $this->layout = Layout\Layout::startMvc();
 }
Пример #4
0
 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\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();
 }
Пример #5
0
 /**
  * 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\HelperBroker::resetHelpers();
     $this->front = Controller\Front::getInstance();
     $this->front->resetInstance();
     $this->front->addModuleDirectory(dirname(__FILE__) . '/../../_files/modules');
     $this->layout = Layout\Layout::startMvc();
     $this->helper = new Helper\ContextSwitch();
     HelperBroker\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(dirname(__FILE__));
     $this->view = new \Zend\View\View();
     $this->viewRenderer = HelperBroker\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);
 }
Пример #6
0
 /**
  * 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\HelperBroker::resetHelpers();
     HelperBroker\HelperBroker::addPrefix('Zend\\Controller\\Action\\Helper');
     $this->front = \Zend\Controller\Front::getInstance();
     $this->front->resetInstance();
     $this->front->addModuleDirectory(dirname(__FILE__) . '/../../_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(dirname(__FILE__) . '/../../../../../library/Zend/View/Helper/');
     $this->viewRenderer = HelperBroker\HelperBroker::getStaticHelper('viewRenderer');
     $this->viewRenderer->setView($this->view);
     $this->controller = new AjaxContextTestController($this->request, $this->response, array());
     $this->helper->setActionController($this->controller);
 }
Пример #7
0
 /**
  * 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\HelperBroker::resetHelpers();
 }
Пример #8
0
 /**
  * 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\HelperBroker::resetHelpers();
 }