aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-05-09 22:00:38 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2011-05-12 20:13:30 -0400
commit0462ab3a4a5cea64699eaf4b2e9900e36d027e50 (patch)
treec9c3b357fef34a77c962378789a1bca61fc885dc /tests
parent49cf28a9c43060d2a4c4d5fe882fc3c7dedd7d0b (diff)
downloadforums-0462ab3a4a5cea64699eaf4b2e9900e36d027e50.tar
forums-0462ab3a4a5cea64699eaf4b2e9900e36d027e50.tar.gz
forums-0462ab3a4a5cea64699eaf4b2e9900e36d027e50.tar.bz2
forums-0462ab3a4a5cea64699eaf4b2e9900e36d027e50.tar.xz
forums-0462ab3a4a5cea64699eaf4b2e9900e36d027e50.zip
[feature/template-engine] Add back IN_PHPBB preamble.
PHPBB3-9726
Diffstat (limited to 'tests')
-rw-r--r--tests/template/template_compile_test.php32
-rw-r--r--tests/template/templates/trivial.html1
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/template/template_compile_test.php b/tests/template/template_compile_test.php
new file mode 100644
index 0000000000..2f12292870
--- /dev/null
+++ b/tests/template/template_compile_test.php
@@ -0,0 +1,32 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2008 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/template.php';
+
+class phpbb_template_template_compile_test extends phpbb_test_case
+{
+ private $template_compile;
+ private $template_path;
+
+ protected function setUp()
+ {
+ $this->template_compile = new phpbb_template_compile();
+ $this->template_path = dirname(__FILE__) . '/templates';
+ }
+
+ public function test_in_phpbb()
+ {
+ $output = $this->template_compile->compile_file($this->template_path . '/trivial.html');
+ $this->assertTrue(strlen($output) > 0);
+ $statements = explode(';', $output);
+ $first_statement = $statements[0];
+ $this->assertTrue(!!preg_match('#if.*defined.*IN_PHPBB.*exit#', $first_statement));
+ }
+}
diff --git a/tests/template/templates/trivial.html b/tests/template/templates/trivial.html
new file mode 100644
index 0000000000..3a1c1c5324
--- /dev/null
+++ b/tests/template/templates/trivial.html
@@ -0,0 +1 @@
+This is a trivial template.