Exemple #1
0
 public function process($action)
 {
     $this->init();
     $variables = (array) $this->{$action}();
     if ($this->view) {
         $this->view->setVariables($variables);
         return $this->view->render();
     }
 }
Exemple #2
0
 public function testVariables()
 {
     $view = new \Rapid\View();
     $this->assertEquals(array(), $view->variables(), 'Variables are not empty');
     $view->setVariable('abc', 1);
     $this->assertEquals(1, $view->variable('abc'), 'Method View::variable() returns incorrect value');
     $this->assertEquals(1, $view->abc, 'Magic method returns incorrect value');
     $vars = array('abcc' => 2, 'dsa' => 3);
     $view->setVariables($vars);
     $this->assertEquals(array_merge($vars, array('abc' => 1)), $view->variables(), 'Variables contain incorrect values');
 }