mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/10800] Changing template paths in tests
Changing template paths in tests from absolute to relative PHPBB3-10800
This commit is contained in:
parent
2a92fee06d
commit
51347ebc09
5 changed files with 12 additions and 11 deletions
|
@ -17,11 +17,10 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes
|
||||||
$this->setup_engine(array('assets_version' => 1));
|
$this->setup_engine(array('assets_version' => 1));
|
||||||
|
|
||||||
// Prepare correct result
|
// Prepare correct result
|
||||||
$dir = dirname(__FILE__);
|
|
||||||
$scripts = array(
|
$scripts = array(
|
||||||
'<script src="' . $dir . '/templates/parent_and_child.html?assets_version=1"></script>',
|
'<script src="' . $this->test_path . '/templates/parent_and_child.html?assets_version=1"></script>',
|
||||||
'<script src="' . $dir . '/parent_templates/parent_only.html?assets_version=1"></script>',
|
'<script src="' . $this->test_path . '/parent_templates/parent_only.html?assets_version=1"></script>',
|
||||||
'<script src="' . $dir . '/templates/child_only.html?assets_version=1"></script>'
|
'<script src="' . $this->test_path . '/templates/child_only.html?assets_version=1"></script>'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Run test
|
// Run test
|
||||||
|
|
|
@ -17,21 +17,21 @@ class phpbb_template_template_locate_test extends phpbb_template_template_test_c
|
||||||
// First element of the array is test name - keep them distinct
|
// First element of the array is test name - keep them distinct
|
||||||
array(
|
array(
|
||||||
'simple inheritance - only parent template exists',
|
'simple inheritance - only parent template exists',
|
||||||
dirname(__FILE__) . '/parent_templates/parent_only.html',
|
$this->test_path . '/parent_templates/parent_only.html',
|
||||||
'parent_only.html',
|
'parent_only.html',
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'simple inheritance - only child template exists',
|
'simple inheritance - only child template exists',
|
||||||
dirname(__FILE__) . '/templates/child_only.html',
|
$this->test_path . '/templates/child_only.html',
|
||||||
'child_only.html',
|
'child_only.html',
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'simple inheritance - both parent and child templates exist',
|
'simple inheritance - both parent and child templates exist',
|
||||||
dirname(__FILE__) . '/templates/parent_and_child.html',
|
$this->test_path . '/templates/parent_and_child.html',
|
||||||
'parent_and_child.html',
|
'parent_and_child.html',
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
|
|
|
@ -277,7 +277,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
|
||||||
$this->template->set_filenames(array('test' => $filename));
|
$this->template->set_filenames(array('test' => $filename));
|
||||||
$this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist');
|
$this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist');
|
||||||
|
|
||||||
$expecting = sprintf('style resource locator: File for handle test does not exist. Could not find: %s', realpath($this->template_path . '/../') . '/templates/' . $filename);
|
$expecting = sprintf('style resource locator: File for handle test does not exist. Could not find: %s', $this->test_path . '/templates/' . $filename);
|
||||||
$this->setExpectedTriggerError(E_USER_ERROR, $expecting);
|
$this->setExpectedTriggerError(E_USER_ERROR, $expecting);
|
||||||
|
|
||||||
$this->display('test');
|
$this->display('test');
|
||||||
|
|
|
@ -18,6 +18,8 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
protected $style_resource_locator;
|
protected $style_resource_locator;
|
||||||
protected $style_provider;
|
protected $style_provider;
|
||||||
|
|
||||||
|
protected $test_path = 'tests/template';
|
||||||
|
|
||||||
// Keep the contents of the cache for debugging?
|
// Keep the contents of the cache for debugging?
|
||||||
const PRESERVE_CACHE = true;
|
const PRESERVE_CACHE = true;
|
||||||
|
|
||||||
|
@ -63,7 +65,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
$defaults = $this->config_defaults();
|
$defaults = $this->config_defaults();
|
||||||
$config = new phpbb_config(array_merge($defaults, $new_config));
|
$config = new phpbb_config(array_merge($defaults, $new_config));
|
||||||
|
|
||||||
$this->template_path = dirname(__FILE__) . '/templates';
|
$this->template_path = $this->test_path . '/templates';
|
||||||
$this->style_resource_locator = new phpbb_style_resource_locator();
|
$this->style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$this->style_provider = new phpbb_style_path_provider();
|
$this->style_provider = new phpbb_style_path_provider();
|
||||||
$this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator);
|
$this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator);
|
||||||
|
|
|
@ -18,8 +18,8 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
|
||||||
$defaults = $this->config_defaults();
|
$defaults = $this->config_defaults();
|
||||||
$config = new phpbb_config(array_merge($defaults, $new_config));
|
$config = new phpbb_config(array_merge($defaults, $new_config));
|
||||||
|
|
||||||
$this->template_path = dirname(__FILE__) . '/templates';
|
$this->template_path = $this->test_path . '/templates';
|
||||||
$this->parent_template_path = dirname(__FILE__) . '/parent_templates';
|
$this->parent_template_path = $this->test_path . '/parent_templates';
|
||||||
$this->style_resource_locator = new phpbb_style_resource_locator();
|
$this->style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$this->style_provider = new phpbb_style_path_provider();
|
$this->style_provider = new phpbb_style_path_provider();
|
||||||
$this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator);
|
$this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator);
|
||||||
|
|
Loading…
Add table
Reference in a new issue