diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-05-11 13:46:04 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-17 16:39:59 -0500 |
commit | 0df0c6199b89f154eb6371118b4a796a4d05f36f (patch) | |
tree | a32a3ff3fe2fea1d4e566348108cfb2b75db8d8a /tests | |
parent | 667f8d581f8534a386e8293caafb4b7b5f063dde (diff) | |
download | forums-0df0c6199b89f154eb6371118b4a796a4d05f36f.tar forums-0df0c6199b89f154eb6371118b4a796a4d05f36f.tar.gz forums-0df0c6199b89f154eb6371118b4a796a4d05f36f.tar.bz2 forums-0df0c6199b89f154eb6371118b4a796a4d05f36f.tar.xz forums-0df0c6199b89f154eb6371118b4a796a4d05f36f.zip |
[feature/template-events] Switch template event test to data providers.
PHPBB3-9550
Diffstat (limited to 'tests')
-rw-r--r-- | tests/template/template_events_test.php | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 3ad6e924cb..f1d13c1fd6 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -11,30 +11,48 @@ require_once dirname(__FILE__) . '/template_test_case.php'; class phpbb_template_template_events_test extends phpbb_template_template_test_case { - public function test_simple_event() + public function template_data() { - // Reset the engine state - $this->setup_engine(); - - // Prepare correct result - $contents = "Simple in trivial extension."; - - // Run test - $cache_file = $this->template->cachepath . 'event_simple.html.php'; - $this->run_template('event_simple.html', array(), array(), array(), $contents, $cache_file); + return array( + /* + array( + '', // File + array(), // vars + array(), // block vars + array(), // destroy + '', // Expected result + ), + */ + array( + 'Simple template event', + 'event_simple.html', + array(), + array(), + array(), + "Simple in trivial extension.", + ), + array( + 'Universal template event ("all" style)', + 'event_universal.html', + array(), + array(), + array(), + "Universal in trivial extension.", + ), + ); } - public function test_universal_event() + /** + * @dataProvider template_data + */ + public function test_event($desc, $file, array $vars, array $block_vars, array $destroy, $expected) { // 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); + $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php'; + $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file); } protected function setup_engine(array $new_config = array()) |