Ejemplo n.º 1
0
 public function testFirst()
 {
     $view = new \Sohoa\Framework\View\Greut();
     $data = $view->getData();
     $view->setPath(dirname(dirname(dirname(__FILE__))) . "/Template");
     // Impossible de tester avec le protocol hoa://
     $data->title = 'Title';
     $data->lang = 'FR-fr';
     $data->foo = 'Bar';
     $data->charset = 'utf-8';
     $output = $view->renderFile('./index.tpl.php');
     $header = $view->getHeaders();
     $this->string($output)->hasLengthGreaterThan(1449);
     $this->sizeof($header)->isIdenticalTo(1);
     $this->sizeof($header[0])->isIdenticalTo(4);
     $this->exception(function () use($view) {
         $view->renderFile('./anFileWhoNotExists.php');
     });
 }
Ejemplo n.º 2
0
 protected function index($list)
 {
     $classname = '';
     $ns = '';
     $greut = new \Sohoa\Framework\View\Greut();
     $data = $greut->getData();
     $data->fqcn = $ns;
     $folder = [];
     $file = [];
     foreach ($list as $class) {
         $real = $ns . '\\' . $class;
         if (in_array(substr($real, 1), $this->_allclass)) {
             $file[] = $real;
         } else {
             $folder[] = $real;
         }
     }
     $data->file = $file;
     $data->title = '';
     $data->folder = $folder;
     $data->all = $this->_allclass;
     $greut->setPath($this->_resource . '/../');
     $file = $greut->renderFile('Ns.tpl.php') . "\n";
     $uri = $this->_uri('index');
     if ($this->getArgument('dry') === false) {
         file_put_contents($uri, $file);
     }
     //if($this->getArgument('debug') === true)
     echo 'NS : ' . $uri . "\n";
 }