示例#1
0
 public function test_includephp_absolute()
 {
     global $phpbb_root_path;
     $filesystem = new \phpbb\filesystem\filesystem();
     $path_to_php = str_replace('\\', '/', dirname(__FILE__)) . '/templates/_dummy_include.php.inc';
     $this->assertTrue($filesystem->is_absolute_path($path_to_php));
     $template_text = "Path is absolute.\n<!-- INCLUDEPHP {$path_to_php} -->";
     $cache_dir = $phpbb_root_path . 'cache/';
     $fp = fopen($cache_dir . 'includephp_absolute.html', 'w');
     fputs($fp, $template_text);
     fclose($fp);
     $this->setup_engine(array('tpl_allow_php' => true));
     $this->template->set_custom_style('tests', $cache_dir);
     $this->run_template('includephp_absolute.html', array(), array(), array(), "Path is absolute.\ntesting included php");
     $this->template->set_filenames(array('test' => 'includephp_absolute.html'));
     $this->assertEquals("Path is absolute.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP");
 }