Пример #1
-1
 public function testViewOptions()
 {
     $config = array('cache' => array('service' => 'otherCache'));
     $di = new Phalcon\DI();
     $di->set('otherCache', function () {
         $frontend = new Phalcon\Cache\Frontend\Output(array('lifetime' => 60));
         return new Phalcon\Cache\Backend\File($frontend, array('cacheDir' => 'unit-tests/cache/'));
     });
     $view = new Phalcon\Mvc\View($config);
     $view->setDI($di);
     $view->setViewsDir('unit-tests/views/');
     $date = date("r");
     $content = '<html>' . $date . '</html>' . PHP_EOL;
     $view->setVar("date", $date);
     $view->start();
     $view->cache(true);
     $view->render('test8', 'other');
     $view->finish();
     $this->assertEquals($view->getContent(), $content);
     $view->reset();
     sleep(1);
     $view->setVar("date", date("r"));
     $view->start();
     $view->cache(true);
     $view->render('test8', 'other');
     $view->finish();
     $this->assertEquals($view->getContent(), $content);
 }