Пример #1
0
 public function testVoltCompilerFileOptions()
 {
     $di = new Phalcon\DI();
     $view = new Phalcon\Mvc\View();
     $volt = new Phalcon\Mvc\View\Engine\Volt($view, $di);
     $volt->setOptions(array("compiledPath" => "unit-tests/cache/", "compiledSeparator" => ".", "compiledExtension" => ".compiled"));
     @unlink('unit-tests/views/test10/index.volt.php');
     @unlink('unit-tests/cache/unit-tests.views.test10.index.volt.compiled');
     //Render simple view
     $view->start();
     $volt->render('unit-tests/views/test10/index.volt', array('song' => 'Lights'), true);
     $view->finish();
     $path = 'unit-tests/cache/' . phalcon_prepare_virtual_path(realpath("unit-tests/"), ".") . '.views.test10.index.volt.compiled';
     $this->assertTrue(file_exists($path));
     $this->assertEquals(file_get_contents($path), 'Hello <?php echo $song; ?>!');
     $this->assertEquals($view->getContent(), 'Hello Lights!');
 }