diff --git a/tests/template/ext/trivial/styles/all/template/universal.html b/tests/template/ext/trivial/styles/all/template/universal.html new file mode 100644 index 0000000000..f2c5762ade --- /dev/null +++ b/tests/template/ext/trivial/styles/all/template/universal.html @@ -0,0 +1 @@ +Universal in trivial extension. diff --git a/tests/template/ext/trivial/styles/silver/template/simple.html b/tests/template/ext/trivial/styles/silver/template/simple.html new file mode 100644 index 0000000000..fe32a1ed3f --- /dev/null +++ b/tests/template/ext/trivial/styles/silver/template/simple.html @@ -0,0 +1 @@ +Simple in trivial extension. diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 2d6fd4bfb2..3ad6e924cb 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -11,31 +11,30 @@ require_once dirname(__FILE__) . '/template_test_case.php'; class phpbb_template_template_events_test extends phpbb_template_template_test_case { - public function test_includejs_compilation() + public function test_simple_event() { // Reset the engine state $this->setup_engine(); // Prepare correct result - $dir = dirname(__FILE__); - $files = array( - $dir . '/templates/child_only.html', - $dir . '/parent_templates/parent_only.html', - $dir . '/templates/parent_and_child.html' - ); - $contents = ''; - foreach ($files as $file) - { - if (file_exists($file)) - { - $contents .= file_get_contents($file); - } - } - $contents = trim($contents); + $contents = "Simple in trivial extension."; // Run test - $cache_file = $this->template->cachepath . 'events.html.php'; - $this->run_template('events.html', array(), array(), array(), $contents, $cache_file); + $cache_file = $this->template->cachepath . 'event_simple.html.php'; + $this->run_template('event_simple.html', array(), array(), array(), $contents, $cache_file); + } + + public function test_universal_event() + { + // Reset the engine state + $this->setup_engine(); + + // Prepare correct result + $contents = "Universal in trivial extension."; + + // Run test + $cache_file = $this->template->cachepath . 'event_universal.html.php'; + $this->run_template('event_universal.html', array(), array(), array(), $contents, $cache_file); } protected function setup_engine(array $new_config = array()) @@ -46,11 +45,20 @@ class phpbb_template_template_events_test extends phpbb_template_template_test_c $config = new phpbb_config(array_merge($defaults, $new_config)); $this->template_path = dirname(__FILE__) . '/templates'; - $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; $this->style_resource_locator = new phpbb_style_resource_locator(); + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'trivial' => array( + 'ext_name' => 'trivial', + 'ext_active' => true, + 'ext_path' => 'ext/trivial/', + ), + ) + ); + $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->extension_manager); $this->style_provider = new phpbb_style_path_provider(); - $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator); $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); - $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), ''); + $this->style->set_custom_style('tests', array($this->template_path), ''); } } diff --git a/tests/template/templates/event_simple.html b/tests/template/templates/event_simple.html new file mode 100644 index 0000000000..604c1acdce --- /dev/null +++ b/tests/template/templates/event_simple.html @@ -0,0 +1 @@ + diff --git a/tests/template/templates/event_universal.html b/tests/template/templates/event_universal.html new file mode 100644 index 0000000000..15425cacc3 --- /dev/null +++ b/tests/template/templates/event_universal.html @@ -0,0 +1 @@ +