diff options
author | Nils Adermann <naderman@naderman.de> | 2011-08-13 23:59:15 -0400 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-08-13 23:59:15 -0400 |
commit | 6fa83ba876c6ec780e51554a09b7937928e7ce0c (patch) | |
tree | 497054fca07bc6fb74613862fe7895c087fb9765 /tests/template/template_inheritance_test.php | |
parent | 4754e11d67da22f2c4674a5f8d8c39af6a8e7ca1 (diff) | |
parent | 41de09e408bc314c3020084fb7c5ec4a4c7262b5 (diff) | |
download | forums-6fa83ba876c6ec780e51554a09b7937928e7ce0c.tar forums-6fa83ba876c6ec780e51554a09b7937928e7ce0c.tar.gz forums-6fa83ba876c6ec780e51554a09b7937928e7ce0c.tar.bz2 forums-6fa83ba876c6ec780e51554a09b7937928e7ce0c.tar.xz forums-6fa83ba876c6ec780e51554a09b7937928e7ce0c.zip |
Merge remote-tracking branch 'github-p/feature/template-engine' into develop
* github-p/feature/template-engine: (87 commits)
[feature/template-engine] Delete _get_locator function.
[feature/template-engine] Clean up template locator usage in bbcode.
[feature/template-engine] Need to call set_template on template.
[feature/template-engine] Update installer for template engine changes.
[feature/template-engine] Dependency inject locator into template.
[feature/template-engine] Delete useless code from set_template.
[feature/template-engine] Delete no longer used $template_filename property.
[feature/template-engine] Delete useless $template globalization.
[feature/template-engine] Use template engine class in bbcode class.
[feature/template-engine] Corrected an error message in template locator.
[feature/template-engine] Remaining documentation.
[feature/template-engine] More documentation for template class.
[feature/template-engine] Create load_and_render to reduce code duplication.
[feature/template-engine] Get rid of orig_tpl_* in template engine.
[feature/template-engine] Delete $style_name param from locator's set_custom_template.
[feature/template-engine] Add constructor to template locator.
[feature/template-engine] Factor template locator out of template class.
[feature/template-engine] Delete $files_template property.
[feature/template-engine] Rename is_absolute to phpbb_is_absolute.
[feature/template-engine] Test template DEFINE statements across files
...
Conflicts:
.gitignore
phpBB/includes/template.php
Diffstat (limited to 'tests/template/template_inheritance_test.php')
-rw-r--r-- | tests/template/template_inheritance_test.php | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php new file mode 100644 index 0000000000..d62562ff0d --- /dev/null +++ b/tests/template/template_inheritance_test.php @@ -0,0 +1,75 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +require_once dirname(__FILE__) . '/template_test_case.php'; + +class phpbb_template_template_inheritance_test extends phpbb_template_template_test_case +{ + /** + * @todo put test data into templates/xyz.test + */ + public static function template_data() + { + return array( + // First element of the array is test name - keep them distinct + array( + 'simple inheritance - only parent template exists', + 'parent_only.html', + array(), + array(), + array(), + "Only in parent.", + ), + array( + 'simple inheritance - only child template exists', + 'child_only.html', + array(), + array(), + array(), + "Only in child.", + ), + array( + 'simple inheritance - both parent and child templates exist', + 'parent_and_child.html', + array(), + array(), + array(), + "Child template.", + ), + ); + } + + /** + * @dataProvider template_data + */ + public function test_template($name, $file, array $vars, array $block_vars, array $destroy, $expected) + { + $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php'; + + $this->assertFileNotExists($cache_file); + + $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file); + + // Reset the engine state + $this->setup_engine(); + + $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file); + } + + protected function setup_engine() + { + global $phpbb_root_path, $phpEx, $config, $user; + + $this->template_path = dirname(__FILE__) . '/templates'; + $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; + $this->template_locator = new phpbb_template_locator(); + $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->template_locator); + $this->template->set_custom_template($this->template_path, 'tests', $this->parent_template_path); + } +} |