aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2010-07-12 01:53:58 +0200
committerAndreas Fischer <bantu@phpbb.com>2010-07-12 01:53:58 +0200
commit88f6caf012e9bc9cead2fe04d13e7459c9b5364b (patch)
tree01b8410fbb412ac91db48c8efc48458617e80bcb
parenteb7254a0c455ef3bae098eb86c016c639aea9104 (diff)
parentbbc3105466ccd43d94423325a68c626c76dec5f9 (diff)
downloadforums-88f6caf012e9bc9cead2fe04d13e7459c9b5364b.tar
forums-88f6caf012e9bc9cead2fe04d13e7459c9b5364b.tar.gz
forums-88f6caf012e9bc9cead2fe04d13e7459c9b5364b.tar.bz2
forums-88f6caf012e9bc9cead2fe04d13e7459c9b5364b.tar.xz
forums-88f6caf012e9bc9cead2fe04d13e7459c9b5364b.zip
Merge branch 'ticket/naderman/9701' into develop-olympus
* ticket/naderman/9701: [ticket/9701] Prevent notices from being hidden by template tests
-rw-r--r--tests/template/template.php24
1 files changed, 21 insertions, 3 deletions
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)");
}