aboutsummaryrefslogtreecommitdiffstats
path: root/tests/template/template_events_test.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-05-11 13:39:38 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2012-11-17 16:39:59 -0500
commit667f8d581f8534a386e8293caafb4b7b5f063dde (patch)
tree077b09ba93c7d61a02825232f526bda3d2737ab4 /tests/template/template_events_test.php
parent09b4cf2f4c6df4d967f4df66f2bb29e38ee10a1d (diff)
downloadforums-667f8d581f8534a386e8293caafb4b7b5f063dde.tar
forums-667f8d581f8534a386e8293caafb4b7b5f063dde.tar.gz
forums-667f8d581f8534a386e8293caafb4b7b5f063dde.tar.bz2
forums-667f8d581f8534a386e8293caafb4b7b5f063dde.tar.xz
forums-667f8d581f8534a386e8293caafb4b7b5f063dde.zip
[feature/template-events] Add a universal template event test.
Also drop the irrelevant includejs code and add a simple template event test. The simple test is not working yet however due to the template engine not correctly tracking which template it is rendering. PHPBB3-9550
Diffstat (limited to 'tests/template/template_events_test.php')
-rw-r--r--tests/template/template_events_test.php50
1 files changed, 29 insertions, 21 deletions
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), '');
}
}