public function testSetScope() { $this->view->loadTemplate('string:{block name="testBlock"}Content{$test}{/block}'); $this->view->setScope(1); $this->view->assign('test', 'Variable'); $this->assertArrayCount(1, $this->view->Engine()->tpl_vars); $this->view->clearAssign(); $this->view->setScope(3); $this->view->assign('test', 'Variable'); $this->assertArrayCount(0, $this->view->Engine()->tpl_vars); }
/** * Reset all instances, resources and init the internal view, template and front properties */ public function reset() { $app = Enlight_Application::Instance(); $this->resetRequest(); $this->resetResponse(); // Force the assignments to be cleared. Needed for some test cases if ($this->_view && $this->_view->hasTemplate()) { $this->_view->clearAssign(); } $this->_view = null; $this->_template = null; $this->_front = null; $app->Plugins()->reset(); //$app->Hooks()->resetHooks(); $app->Events()->reset(); //$app->Db()->getProfiler()->clear(); $app->Bootstrap()->resetResource('Plugins')->resetResource('Front')->resetResource('Router')->resetResource('System')->resetResource('Modules')->resetResource('Models'); // ->resetResource('Config') // ->resetResource('Shop'); // ->resetResource('Session') // ->resetResource('Auth'); $app->Bootstrap()->loadResource('Front'); $app->Bootstrap()->loadResource('Plugins'); }