1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 15:16:16 +02:00

[ticket/10882] Add a test for including a nonexistent file.

PHPBB3-10882
This commit is contained in:
Oleg Pudeyev 2012-05-10 03:36:58 -04:00
parent 720d07c9b3
commit 56b2b87423
3 changed files with 34 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -0,0 +1 @@
<!-- INCLUDE nonexistent.html -->

View File

@ -0,0 +1 @@
style resource locator: File for handle nonexistent.html does not exist. Could not find: