public function testViewrendererに追加できる() { $path = GENE_TEST_ROOT . '/library/var/view/'; $spec = ':module/:controller/:action.:suffix'; $param = array('template' => array('engine' => 'Phtml', 'path' => $path, 'spec' => $spec), 'Phtml' => array('className' => 'Zend_View', 'template' => array('suffix' => 'phtml'))); $instance = new Gene_View_Adapter($param); $renderer = new Zend_Controller_Action_Helper_ViewRenderer(); $instance->setViewRenderer($renderer); $this->assertEquals($renderer->getViewScriptPathSpec(), $spec); $this->assertEquals($renderer->getViewBasePathSpec(), $path); }
/** * Init view * * @access protected * @return Gene_Bootstrap Fluent interface */ protected function _initView() { // Load config file $path = $this->_configPath . 'view.ini'; $config = Gene_Config::load($path, $this->_cache); if (is_null($config)) { return $this; } $view = new Gene_View_Adapter($config); $renderer = new Zend_Controller_Action_Helper_ViewRenderer(); $view->setViewRenderer($renderer); return $this; }
public function testLayoutを設定できる() { $appPath = dirname(__FILE__); $path = GENE_TEST_ROOT . '/var/config/view.ini'; $config = new Zend_Config_Ini($path); $instance = new Gene_View_Adapter($config); $view = $instance->getView(); $instance->setLayout($config->toArray()); $front = Zend_Controller_Front::getInstance(); $plugin = $front->getPlugin('Zend_Layout_Controller_Plugin_Layout'); $layout = $plugin->getLayout(); $this->assertEquals($layout->getContentKey(), 'content'); }
public function testView生成時にdelimiterを設定しない場合デフォルトが設定される() { $param = array('template' => array('engine' => 'Smarty'), 'Smarty' => array('className' => 'Gene_Smarty_View', 'template' => array('suffix' => 'phtml'), 'cache' => array('path' => GENE_TEST_ROOT . '/var/cache/smarty/'))); $instance = new Gene_View_Adapter($param); $view = $instance->getView('Smarty'); $engine = $view->getEngine(); $this->assertEquals($engine->left_delimiter, '{'); $this->assertEquals($engine->right_delimiter, '}'); }