diff --git a/tests/template/template.php b/tests/template/template.php index 145fe8de61..024d3712f7 100644 --- a/tests/template/template.php +++ b/tests/template/template.php @@ -26,12 +26,24 @@ class phpbb_template_template_test extends phpbb_test_case error_reporting($error_level & ~E_NOTICE); ob_start(); - $this->assertTrue($this->template->display($handle, false)); + + try + { + $this->assertTrue($this->template->display($handle, false)); + } + catch (Exception $exception) + { + // reset the error level even when an error occured + // PHPUnit turns trigger_error into exceptions as well + error_reporting($error_level); + throw $exception; + } + + $result = self::trim_template_result(ob_get_clean()); // reset error level error_reporting($error_level); - - return self::trim_template_result(ob_get_clean()); + return $result; } private static function trim_template_result($result) @@ -368,9 +380,15 @@ class phpbb_template_template_test extends phpbb_test_case $this->template->destroy_block_vars($block); } + $error_level = error_reporting(); + error_reporting($error_level & ~E_NOTICE); + $this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)"); $this->template->assign_display('test', 'VARIABLE', false); + + error_reporting($error_level); + $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)"); }