From dcf0b15c9fc90dc324e315ee056d3cbf67ed1928 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 23 Nov 2008 03:50:16 +0000 Subject: [PATCH] Will he ever be happy? ... git-svn-id: file:///svn/phpbb/trunk@9094 89ea8834-ac86-4346-8a33-228a782c2dd0 --- tests/template/template.php | 43 ++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 25 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,32 +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); - - foreach ($block_vars as $block => $loops) - { - foreach ($loops as $_vars) - { - $this->template->assign_block_vars($block, $_vars); - } - } - - $this->assertEquals($expected, $this->display('test'), "Testing $file"); - $this->assertFileExists($cache_file); - - // Reset the engine state - $this->setup_engine(); - $this->template->set_filenames(array('test' => $file)); $this->template->assign_vars($vars); @@ -186,5 +162,22 @@ class phpbb_template_template_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, $this->display('test'), "Testing $file"); $this->assertFileExists($cache_file); } + + /** + * @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->assertFileNotExists($cache_file); + + $this->run_template($file, $vars, $block_vars, $expected, $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