Merge branch 'ticket/naderman/9701' into develop-olympus

* ticket/naderman/9701:
  [ticket/9701] Prevent notices from being hidden by template tests
This commit is contained in:
Andreas Fischer 2010-07-12 01:53:58 +02:00
commit 88f6caf012

View file

@ -26,12 +26,24 @@ class phpbb_template_template_test extends phpbb_test_case
error_reporting($error_level & ~E_NOTICE); error_reporting($error_level & ~E_NOTICE);
ob_start(); ob_start();
try
{
$this->assertTrue($this->template->display($handle, false)); $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 // reset error level
error_reporting($error_level); error_reporting($error_level);
return $result;
return self::trim_template_result(ob_get_clean());
} }
private static function trim_template_result($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); $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->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)");
$this->template->assign_display('test', 'VARIABLE', false); $this->template->assign_display('test', 'VARIABLE', false);
error_reporting($error_level);
$this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)"); $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)");
} }