public function _ExceptionException($exception) { $modelAndView = new ModelAndView('layout'); $modelAndView->add(array('viewName' => 'exception')); $modelAndView->add(array('exception' => $exception)); return $modelAndView; }
public function someAction($optional = 'yeah') { $session = HttpSession::getSession(); $session->setAttribute('aSessionVariable', array('user' => 'aUser')); $modelAndView = new ModelAndView('some'); $modelAndView->add(array('somestring' => 'Hello World', 'arguments' => func_get_args(), 'optional' => $optional)); $modelAndView->add(array('headers' => array('Cache-Control: no-cache', 'Pragma: no-cache'))); return $modelAndView; }
/** * @test */ public function can_get_set_model() { $mav = new ModelAndView('name'); $mav->add(array('key1' => 'value1')); $model = $mav->getModel(); $this->assertEquals($model['key1'], 'value1'); }
/** * @test */ public function can_render_and_translate() { // For language stuff ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . RESOURCES_DIR); $this->expectOutputString('hi there'); $mav = new ModelAndView('some'); $mav->add(array('headers' => array('HTTP/1.0 404 Not Found'))); $container = ContainerImpl::getInstance($this->_properties); $resolver = $container->getBean('HttpViewResolver3'); $view = $resolver->resolve($mav); $render = $container->getBean('HttpViewRender'); $render->render($view); $this->assertEquals($render->translate('abundle', 'message.some', array('arg1' => '1', 'arg2' => '2', 'arg3' => '3')), 'This is a test message, arg1=1 arg2=2 arg3=3'); $session = HttpSession::getSession(); $session->setAttribute('LANGUAGE', 'es_AR'); $this->assertEquals($render->translate('abundle', 'message.some', array('arg1' => '1', 'arg2' => '2', 'arg3' => '3')), 'Este es un mensaje de prueba, arg1=1 arg2=2 arg3=3'); }
public function mainAction() { $modelAndView = new ModelAndView('layout'); $modelAndView->add(array('viewName' => 'home')); return $modelAndView; }
public function somethingSmartyAction() { $model = new ModelAndView('someSmarty'); $model->add(array('a' => 'b')); return $model; }