mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-04 22:58:10 +02:00
[ticket/10882] Add a test for including a nonexistent file.
PHPBB3-10882
This commit is contained in:
parent
720d07c9b3
commit
56b2b87423
@ -37,6 +37,21 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
|
||||
);
|
||||
}
|
||||
|
||||
public function template_data_error()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'Include a nonexistent file',
|
||||
'invalid/include_nonexistent_file.html',
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
E_USER_ERROR,
|
||||
'invalid/output/include_nonexistent_file.html',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider template_data
|
||||
*/
|
||||
@ -52,4 +67,21 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
|
||||
$expected = trim($expected);
|
||||
$this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider template_data_error
|
||||
*/
|
||||
public function test_template_error($description, $file, $vars, $block_vars, $destroy, $error, $expected)
|
||||
{
|
||||
$cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php';
|
||||
|
||||
$this->assertFileNotExists($cache_file);
|
||||
|
||||
$expected = file_get_contents(dirname(__FILE__) . '/templates/' . $expected);
|
||||
// apparently the template engine does not put
|
||||
// the trailing newline into compiled templates
|
||||
$expected = trim($expected);
|
||||
$this->setExpectedTriggerError($error, $expected);
|
||||
$this->run_template($file, $vars, $block_vars, $destroy, '', $cache_file);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<!-- INCLUDE nonexistent.html -->
|
@ -0,0 +1 @@
|
||||
style resource locator: File for handle nonexistent.html does not exist. Could not find:
|
Loading…
x
Reference in New Issue
Block a user