diff options
-rw-r--r-- | tests/template/template.php | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/tests/template/template.php b/tests/template/template.php index 3e0143f599..f1ab22dc2b 100644 --- a/tests/template/template.php +++ b/tests/template/template.php @@ -146,15 +146,8 @@ class phpbb_template_template_test extends PHPUnit_Framework_TestCase ); } - /** - * @dataProvider template_data - */ - public function test_template($file, array $vars, array $block_vars, $expected) + private function run_template($file, array $vars, array $block_vars, $expected, $cache_file) { - $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.' . PHP_EXT; - - $this->assertFileNotExists($cache_file); - $this->template->set_filenames(array('test' => $file)); $this->template->assign_vars($vars); @@ -168,23 +161,23 @@ class phpbb_template_template_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, $this->display('test'), "Testing $file"); $this->assertFileExists($cache_file); + } - // Reset the engine state - $this->setup_engine(); + /** + * @dataProvider template_data + */ + public function test_template($file, array $vars, array $block_vars, $expected) + { + $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.' . PHP_EXT; - $this->template->set_filenames(array('test' => $file)); - $this->template->assign_vars($vars); + $this->assertFileNotExists($cache_file); - foreach ($block_vars as $block => $loops) - { - foreach ($loops as $_vars) - { - $this->template->assign_block_vars($block, $_vars); - } - } + $this->run_template($file, $vars, $block_vars, $expected, $cache_file); - $this->assertEquals($expected, $this->display('test'), "Testing $file"); - $this->assertFileExists($cache_file); + // Reset the engine state + $this->setup_engine(); + + $this->run_template($file, $vars, $block_vars, $expected, $cache_file); } } ?>
\ No newline at end of file |