Exemplo n.º 1
0
 /**
  * Get View
  *
  * @return \Tlumx\View\View
  */
 public function getView()
 {
     if (!$this->_view) {
         $this->_view = $this->getServiceProvider()->getView();
         if ($this->getServiceProvider()->getTemplatesManager()->hasTemplatePath($this->_controllerName)) {
             $path = $this->getServiceProvider()->getTemplatesManager()->getTemplatePath($this->_controllerName);
             $this->_view->setTemplatesPath($path);
         }
     }
     return $this->_view;
 }
Exemplo n.º 2
0
 public function testDisplay()
 {
     $view = new View();
     $view->name = 'Tlumx';
     $path = sys_get_temp_dir();
     $file = @tempnam($path, 'tlumx_view_');
     file_put_contents($file . '.phtml', 'Hello, <?php echo $this->name; ?>!');
     $view->setTemplatesPath($path);
     $template = ltrim(substr($file, strlen($path)), DIRECTORY_SEPARATOR);
     $view->display($template);
     $this->expectOutputString("Hello, Tlumx!");
     unlink($file);
 }