コード例 #1
0
ファイル: AbstractTest.php プロジェクト: rukavina/zf2
    /**
     * Prepares the environment before running a test
     *
     */
    protected function setUp()
    {
        $cwd = __DIR__;

        // read navigation config
        $this->_files = $cwd . '/_files';
        $config = new \Zend\Config\Xml($this->_files . '/navigation.xml');

        // setup containers from config
        $this->_nav1 = new Navigation\Navigation($config->get('nav_test1'));
        $this->_nav2 = new Navigation\Navigation($config->get('nav_test2'));

        // setup view
        $view = new \Zend\View\PhpRenderer();
        $view->resolver()->addPath($cwd . '/_files/mvc/views');

        // setup front
        $front = Controller\Front::getInstance();
        $this->_oldControllerDir = $front->getControllerDirectory('test');
        $front->setControllerDirectory($cwd . '/_files/mvc/controllers');

        // create helper
        $this->_helper = new $this->_helperName;
        $this->_helper->setView($view);

        // set nav1 in helper as default
        $this->_helper->setContainer($this->_nav1);
    }
コード例 #2
0
 /**
  * Prepares the environment before running a test
  *
  */
 protected function setUp()
 {
     $cwd = dirname(__FILE__);
     // read navigation config
     $this->_files = $cwd . '/_files';
     $config = new Zend_Config_Xml($this->_files . '/navigation.xml');
     // setup containers from config
     $this->_nav1 = new Zend_Navigation($config->get('nav_test1'));
     $this->_nav2 = new Zend_Navigation($config->get('nav_test2'));
     // setup view
     $view = new Zend_View();
     $view->setScriptPath($cwd . '/_files/mvc/views');
     // setup front
     $front = Zend_Controller_Front::getInstance();
     $this->_oldControllerDir = $front->getControllerDirectory('test');
     $front->setControllerDirectory($cwd . '/_files/mvc/controllers');
     // create helper
     $this->_helper = new $this->_helperName();
     $this->_helper->setView($view);
     // set nav1 in helper as default
     $this->_helper->setContainer($this->_nav1);
 }