Beispiel #1
0
 public function testShouldNotBeAbleToRegisterAHelpernameWichIsAlreadyUsedAsMethodnameInView()
 {
     try {
         $view = new View('tests/resources/views/test.php');
         $view->helper('helper', function () {
         });
     } catch (Exception $e) {
         return;
     }
     $this->fail('Should not be able to register a helper with a name which is already used as method name inside of View class');
 }
Beispiel #2
0
 public function create($template, $layout = null)
 {
     if ($layout === null) {
         $layout = $this->config['DEFAULT_LAYOUT'];
     }
     $template = $this->config['TEMPLATES_PATH'] . $template;
     $layout = $this->config['TEMPLATES_PATH'] . $this->config['LAYOUTS_PATH'] . $layout;
     $view = new View($template, $layout);
     $view->bind($this->application_variables);
     foreach ($this->application_helpers as $name => $callback) {
         $view->helper($name, $callback);
     }
     return $view;
 }