Пример #1
0
 protected function _DoStart()
 {
     if (TaskPump::Pump()->GetTaskHistory()->Count() > 0) {
         $task = TaskPump::Pump()->GetTaskHistory()->Top();
         $tpl_name = '';
         if ($task instanceof \phalanx\views\CustomViewTask) {
             $tpl_name = $task->CustomTemplateName();
         } else {
             $loader = $this->template_loader;
             $tpl_name = $loader(get_class($task));
         }
         $data = $this->GetTaskData($task);
         $view = new View($tpl_name);
         $keys = $data->AllKeys();
         foreach ($keys as $key) {
             $view->{$key} = $data->{$key};
         }
         $view->Render();
     }
 }
Пример #2
0
 public function testCacheInvalidate()
 {
     TestView::SetupPaths();
     file_put_contents(View::cache_path() . '/cache_test.phpi', 'Invalid template data');
     $view = new TestView('cache_test');
     // Need to wait for the mtime to make a difference.
     sleep(1);
     clearstatcache();
     // Touch the template to update its mtime.
     touch(sprintf(View::template_path(), 'cache_test'));
     $files = scandir(View::cache_path());
     $this->assertEquals(3, count($files));
     $view->T_Cache();
     $files = scandir(View::cache_path());
     $this->assertEquals(3, count($files));
     $expected = file_get_contents(sprintf(View::template_path(), 'cache_test'));
     $actual = file_get_contents(View::cache_path() . '/cache_test.phpi');
     $this->assertEquals($expected, $actual);
 }
Пример #3
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->cache_prefix = '';
 }